X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02761f6cd478e3c2c97cf6f93442747f7b029833..c2c87924e7e3906b8cf1f93ebbd362eab17f6857:/src/mac/carbon/thread.cpp?ds=sidebyside diff --git a/src/mac/carbon/thread.cpp b/src/mac/carbon/thread.cpp index b8302e571f..cacf2e5e35 100644 --- a/src/mac/carbon/thread.cpp +++ b/src/mac/carbon/thread.cpp @@ -418,10 +418,10 @@ public: wxMutexInternal( wxMutexType mutexType ); virtual ~wxMutexInternal(); - bool IsOk() const - { return m_isOk; } + bool IsOk() const { return m_isOk; } - wxMutexError Lock() ; + wxMutexError Lock() { return Lock(kDurationForever); } + wxMutexError Lock(unsigned long ms); wxMutexError TryLock(); wxMutexError Unlock(); @@ -451,15 +451,23 @@ wxMutexInternal::~wxMutexInternal() MPYield(); } -wxMutexError wxMutexInternal::Lock() +wxMutexError wxMutexInternal::Lock(unsigned long ms) { wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ); - OSStatus err = MPEnterCriticalRegion( m_critRegion, kDurationForever); - if (err != noErr) + OSStatus err = MPEnterCriticalRegion( m_critRegion, ms ); + switch ( err ) { - wxLogSysError(wxT("Could not lock mutex")); - return wxMUTEX_MISC_ERROR; + case noErr: + break; + + case kMPTimeoutErr: + wxASSERT_MSG( ms != kDurationForever, wxT("unexpected timeout") ); + return wxMUTEX_TIMEOUT; + + default: + wxLogSysError(wxT("Could not lock mutex")); + return wxMUTEX_MISC_ERROR; } return wxMUTEX_NO_ERROR; @@ -829,7 +837,7 @@ wxCondError wxConditionInternal::WaitTimeout( unsigned long milliseconds ) wxSemaError err = m_semaphore.WaitTimeout(milliseconds); - if ( err == wxSEMA_BUSY ) + if ( err == wxSEMA_TIMEOUT ) { // another potential race condition exists here it is caused when a // 'waiting' thread timesout, and returns from WaitForSingleObject, but @@ -1640,7 +1648,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) bool wxThreadModule::OnInit() { - bool hasThreadManager = MPLibraryIsLoaded(); + bool hasThreadManager = +#ifdef __LP64__ + true ; // TODO VERIFY IN NEXT BUILD +#else + MPLibraryIsLoaded(); +#endif if ( !hasThreadManager ) {