X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..08670ea85abf4b4946a9ce64971b591d7b1ee30b:/src/osx/carbon/thread.cpp diff --git a/src/osx/carbon/thread.cpp b/src/osx/carbon/thread.cpp index 492b45ab46..429bf44ee4 100644 --- a/src/osx/carbon/thread.cpp +++ b/src/osx/carbon/thread.cpp @@ -121,6 +121,11 @@ void wxCriticalSection::Enter() MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationForever ); } +bool wxCriticalSection::TryEnter() +{ + return MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationImmediate ) == noErr; +} + void wxCriticalSection::Leave() { MPExitCriticalRegion( (MPCriticalRegionID) m_critRegion ); @@ -940,7 +945,7 @@ wxThreadError wxThread::Resume() // 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") ); @@ -953,7 +958,7 @@ wxThread::ExitCode wxThread::Wait() 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") ); @@ -1128,14 +1133,14 @@ void wxThread::SetPriority(unsigned int prio) unsigned int wxThread::GetPriority() const { - wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast + wxCriticalSectionLocker lock(const_cast(m_critsect)); return m_internal->GetPriority(); } unsigned long wxThread::GetId() const { - wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast + wxCriticalSectionLocker lock(const_cast(m_critsect)); return (unsigned long)m_internal->GetId(); } @@ -1191,8 +1196,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) bool wxThreadModule::OnInit() { - bool hasThreadManager = -#ifdef __LP64__ + bool hasThreadManager = +#ifdef __LP64__ true ; // TODO VERIFY IN NEXT BUILD #else MPLibraryIsLoaded(); @@ -1229,12 +1234,10 @@ void wxThreadModule::OnExit() } gs_critsectGui->Leave(); - delete gs_critsectGui; - gs_critsectGui = NULL; + wxDELETE(gs_critsectGui); } - delete gs_critsectWaitingForGui; - gs_critsectWaitingForGui = NULL; + wxDELETE(gs_critsectWaitingForGui); } // ----------------------------------------------------------------------------