X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12b3fbbfd3d1bea36c7a4f1e5f91876ef4a64007..3f4a2351e4c677c88c18ea812b609477adee7380:/src/mac/classic/thread.cpp?ds=inline diff --git a/src/mac/classic/thread.cpp b/src/mac/classic/thread.cpp index ba4a0d012a..52f7603ee3 100644 --- a/src/mac/classic/thread.cpp +++ b/src/mac/classic/thread.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: thread.cpp +// Name: src/mac/classic/thread.cpp // Purpose: wxThread Implementation // Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin // Modified by: Stefan Csomor @@ -10,10 +10,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "thread.h" -#endif - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- @@ -27,11 +23,11 @@ #ifndef WX_PRECOMP #include "wx/wx.h" + #include "wx/module.h" #endif #if wxUSE_THREADS -#include "wx/module.h" #include "wx/thread.h" #ifdef __WXMAC__ @@ -64,7 +60,7 @@ enum wxThreadState // ---------------------------------------------------------------------------- static ThreadID gs_idMainThread = kNoThreadID ; -static bool gs_waitingForThread = FALSE ; +static bool gs_waitingForThread = false ; size_t g_numberOfThreads = 0; // ============================================================================ @@ -437,7 +433,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) if ( err != noErr ) { wxLogSysError(_("Can't create thread")); - return FALSE; + return false; } if ( m_priority != WXTHREAD_DEFAULT_PRIORITY ) @@ -447,7 +443,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) m_state = STATE_NEW; - return TRUE; + return true; } bool wxThreadInternal::Suspend() @@ -462,14 +458,14 @@ bool wxThreadInternal::Suspend() err = ::ThreadEndCritical() ; wxASSERT( err == noErr ) ; wxLogSysError(_("Can not suspend thread %x"), m_tid); - return FALSE; + return false; } m_state = STATE_PAUSED; err = ::SetThreadStateEndCritical(m_tid, kStoppedThreadState, kNoThreadID); - return TRUE; + return true; } bool wxThreadInternal::Resume() @@ -489,7 +485,7 @@ bool wxThreadInternal::Resume() err = ::ThreadEndCritical() ; wxASSERT( err == noErr ) ; wxLogSysError(_("Can not resume thread %x"), m_tid); - return FALSE; + return false; } err = ::SetThreadStateEndCritical(m_tid, kReadyThreadState, kNoThreadID); @@ -498,7 +494,7 @@ bool wxThreadInternal::Resume() err = ::ThreadEndCritical() ; wxASSERT( err == noErr ) ; ::YieldToAnyThread() ; - return TRUE; + return true; } // static functions @@ -549,7 +545,7 @@ void wxThread::Sleep(unsigned long milliseconds) double mssleep = milliseconds * 1000 ; double msstart, msnow ; msstart = (start.hi * 4294967296.0 + start.lo) ; - + do { YieldToAnyThread(); @@ -587,7 +583,7 @@ bool wxThread::SetConcurrency(size_t level) return level == 1; } - return TRUE ; + return true ; } // ctor and dtor @@ -692,7 +688,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) // Delete() is always safe to call, so consider all possible states // has the thread started to run? - bool shouldResume = FALSE; + bool shouldResume = false; { wxCriticalSectionLocker lock(m_critsect); @@ -702,7 +698,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) // WinThreadStart() will see it and terminate immediately m_internal->SetState(STATE_EXITED); - shouldResume = TRUE; + shouldResume = true; } } @@ -716,7 +712,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( IsMain() ) { // set flag for wxIsWaitingForThread() - gs_waitingForThread = TRUE; + gs_waitingForThread = true; #if wxUSE_GUI wxBeginBusyCursor(); @@ -746,7 +742,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( IsMain() ) { - gs_waitingForThread = FALSE; + gs_waitingForThread = false; #if wxUSE_GUI wxEndBusyCursor(); @@ -883,13 +879,13 @@ bool wxThreadModule::OnInit() if ( !hasThreadManager ) { wxLogSysError( wxT("Thread Support is not available on this System") ); - return FALSE ; + return false ; } // no error return for GetCurrentThreadId() MacGetCurrentThread( &gs_idMainThread ) ; - return TRUE; + return true; } void wxThreadModule::OnExit()