MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationForever );
}
+bool wxCriticalSection::TryEnter()
+{
+ return MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationImmediate ) == noErr;
+}
+
void wxCriticalSection::Leave()
{
MPExitCriticalRegion( (MPCriticalRegionID) m_critRegion );
{
m_tid = kInvalidID;
m_state = STATE_NEW;
- m_prio = WXTHREAD_DEFAULT_PRIORITY;
+ m_prio = wxPRIORITY_DEFAULT;
m_notifyQueueId = kInvalidID;
m_exitcode = 0;
m_cancelled = false ;
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;
}
return false;
}
- if ( m_prio != WXTHREAD_DEFAULT_PRIORITY )
+ if ( m_prio != wxPRIORITY_DEFAULT )
SetPriority( m_prio );
return true;
wxThreadError wxThread::Pause()
{
wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR,
- _T("a thread can't pause itself") );
+ wxT("a thread can't pause itself") );
wxCriticalSectionLocker lock(m_critsect);
// 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") );
void wxThread::SetPriority(unsigned int prio)
{
- wxCHECK_RET( ((int)WXTHREAD_MIN_PRIORITY <= (int)prio) &&
- ((int)prio <= (int)WXTHREAD_MAX_PRIORITY),
+ wxCHECK_RET( wxPRIORITY_MIN <= prio && prio <= wxPRIORITY_MAX,
wxT("invalid thread priority") );
wxCriticalSectionLocker lock(m_critsect);
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();
}
bool wxThreadModule::OnInit()
{
- bool hasThreadManager =
-#ifdef __LP64__
+ bool hasThreadManager =
+#ifdef __LP64__
true ; // TODO VERIFY IN NEXT BUILD
#else
MPLibraryIsLoaded();
}
gs_critsectGui->Leave();
- delete gs_critsectGui;
- gs_critsectGui = NULL;
+ wxDELETE(gs_critsectGui);
}
- delete gs_critsectWaitingForGui;
- gs_critsectWaitingForGui = NULL;
+ wxDELETE(gs_critsectWaitingForGui);
}
// ----------------------------------------------------------------------------