X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..2cf3a6d7bef6f20bea35062dd3d4dbf0aec9efb5:/src/mac/classic/thread.cpp?ds=sidebyside diff --git a/src/mac/classic/thread.cpp b/src/mac/classic/thread.cpp index 5e322a719d..ee31c8e7df 100644 --- a/src/mac/classic/thread.cpp +++ b/src/mac/classic/thread.cpp @@ -10,10 +10,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "thread.h" -#endif - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- @@ -77,12 +73,18 @@ public : wxMacStCritical() { if ( UMASystemIsInitialized() ) - ThreadBeginCritical() ; + { + OSErr err = ThreadBeginCritical() ; + wxASSERT( err == noErr ) ; + } } ~wxMacStCritical() { if ( UMASystemIsInitialized() ) - ThreadEndCritical() ; + { + OSErr err = ThreadEndCritical() ; + wxASSERT( err == noErr ) ; + } } }; @@ -133,6 +135,7 @@ wxMutexError wxMutexInternal::Lock() m_waiters.Add(current); err = ::SetThreadStateEndCritical(kCurrentThreadID, kStoppedThreadState, m_owner); err = ::ThreadBeginCritical(); + wxASSERT( err == noErr ) ; } m_owner = current; } @@ -165,6 +168,7 @@ wxMutexError wxMutexInternal::Unlock() { OSErr err; err = ::ThreadBeginCritical(); + wxASSERT( err == noErr ) ; if (m_locked > 0) m_locked--; @@ -446,11 +450,13 @@ bool wxThreadInternal::Suspend() { OSErr err ; - ::ThreadBeginCritical(); + err = ::ThreadBeginCritical(); + wxASSERT( err == noErr ) ; if ( m_state != STATE_RUNNING ) { - ::ThreadEndCritical() ; + err = ::ThreadEndCritical() ; + wxASSERT( err == noErr ) ; wxLogSysError(_("Can not suspend thread %x"), m_tid); return FALSE; } @@ -471,19 +477,22 @@ bool wxThreadInternal::Resume() wxASSERT( err == noErr ) ; wxASSERT( current != m_tid ) ; - ::ThreadBeginCritical(); + err = ::ThreadBeginCritical(); + wxASSERT( err == noErr ) ; + if ( m_state != STATE_PAUSED && m_state != STATE_NEW ) { - ::ThreadEndCritical() ; + err = ::ThreadEndCritical() ; + wxASSERT( err == noErr ) ; wxLogSysError(_("Can not resume thread %x"), m_tid); return FALSE; } err = ::SetThreadStateEndCritical(m_tid, kReadyThreadState, kNoThreadID); - wxASSERT( err == noErr ) ; m_state = STATE_RUNNING; - ::ThreadEndCritical() ; + err = ::ThreadEndCritical() ; + wxASSERT( err == noErr ) ; ::YieldToAnyThread() ; return TRUE; }