X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2646f485163f410baaad5bcf49028c604a352d19..90e572f1e5af1e51fd14e2e1e6f64fa3e258e590:/src/mac/classic/thread.cpp 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; }