/////////////////////////////////////////////////////////////////////////////
-// 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
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
- #pragma implementation "thread.h"
-#endif
-
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#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__
// ----------------------------------------------------------------------------
static ThreadID gs_idMainThread = kNoThreadID ;
-static bool gs_waitingForThread = FALSE ;
+static bool gs_waitingForThread = false ;
size_t g_numberOfThreads = 0;
// ============================================================================
if ( err != noErr )
{
wxLogSysError(_("Can't create thread"));
- return FALSE;
+ return false;
}
if ( m_priority != WXTHREAD_DEFAULT_PRIORITY )
m_state = STATE_NEW;
- return TRUE;
+ return true;
}
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()
err = ::ThreadEndCritical() ;
wxASSERT( err == noErr ) ;
wxLogSysError(_("Can not resume thread %x"), m_tid);
- return FALSE;
+ return false;
}
err = ::SetThreadStateEndCritical(m_tid, kReadyThreadState, kNoThreadID);
err = ::ThreadEndCritical() ;
wxASSERT( err == noErr ) ;
::YieldToAnyThread() ;
- return TRUE;
+ return true;
}
// static functions
double mssleep = milliseconds * 1000 ;
double msstart, msnow ;
msstart = (start.hi * 4294967296.0 + start.lo) ;
-
+
do
{
YieldToAnyThread();
return level == 1;
}
- return TRUE ;
+ return true ;
}
// ctor and dtor
// 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);
// WinThreadStart() will see it and terminate immediately
m_internal->SetState(STATE_EXITED);
- shouldResume = TRUE;
+ shouldResume = true;
}
}
if ( IsMain() )
{
// set flag for wxIsWaitingForThread()
- gs_waitingForThread = TRUE;
+ gs_waitingForThread = true;
#if wxUSE_GUI
wxBeginBusyCursor();
if ( IsMain() )
{
- gs_waitingForThread = FALSE;
+ gs_waitingForThread = false;
#if wxUSE_GUI
wxEndBusyCursor();
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()