X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..f516d986371b7643efda569d64ae19e75d221411:/src/mac/classic/thread.cpp?ds=sidebyside diff --git a/src/mac/classic/thread.cpp b/src/mac/classic/thread.cpp index 77d12e6e8d..ee31c8e7df 100644 --- a/src/mac/classic/thread.cpp +++ b/src/mac/classic/thread.cpp @@ -7,13 +7,9 @@ // RCS-ID: $Id$ // Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998), // Vadim Zeitlin (1999) , Stefan Csomor (2000) -// Licence: wxWidgets licence +// 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; }