MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationForever );
}
+bool wxCriticalSection::TryEnter()
+{
+ return MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationImmediate ) == noErr;
+}
+
void wxCriticalSection::Leave()
{
MPExitCriticalRegion( (MPCriticalRegionID) m_critRegion );
OSStatus err = MPCreateQueue( &m_notifyQueueId );
if (err != noErr)
{
- wxLogSysError( wxT("Cant create the thread event queue") );
+ wxLogSysError( wxT("Can't create the thread event queue") );
return false;
}
// exiting thread
// -----------------------------------------------------------------------------
-wxThread::ExitCode wxThread::Wait()
+wxThread::ExitCode wxThread::Wait(wxThreadWait WXUNUSED(waitMode))
{
wxCHECK_MSG( This() != this, (ExitCode)-1,
wxT("a thread can't wait for itself") );
return m_internal->GetExitCode();
}
-wxThreadError wxThread::Delete(ExitCode *rc)
+wxThreadError wxThread::Delete(ExitCode *rc, wxThreadWait WXUNUSED(waitMode))
{
wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR,
wxT("a thread can't delete itself") );
unsigned int wxThread::GetPriority() const
{
- wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast
+ wxCriticalSectionLocker lock(const_cast<wxCriticalSection &>(m_critsect));
return m_internal->GetPriority();
}
unsigned long wxThread::GetId() const
{
- wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast
+ wxCriticalSectionLocker lock(const_cast<wxCriticalSection &>(m_critsect));
return (unsigned long)m_internal->GetId();
}
}
gs_critsectGui->Leave();
- delete gs_critsectGui;
- gs_critsectGui = NULL;
+ wxDELETE(gs_critsectGui);
}
- delete gs_critsectWaitingForGui;
- gs_critsectWaitingForGui = NULL;
+ wxDELETE(gs_critsectWaitingForGui);
}
// ----------------------------------------------------------------------------