#ifdef __WXMAC__
#include <Threads.h>
#include "wx/mac/uma.h"
+#include "wx/mac/macnotfy.h"
#endif
#define INFINITE 0xFFFFFFFF
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
{
if ( m_locked > 0 )
{
- wxLogDebug(_T("Warning: freeing a locked mutex (%d locks)."), m_locked);
+ wxLogDebug(_T("Warning: freeing a locked mutex (%ld locks)."), m_locked);
}
}
}
bool IsOk() const { return m_mutex.IsOk() ; }
-
+
wxCondError Wait()
{
return WaitTimeout(0xFFFFFFFF );
}
-
+
wxCondError WaitTimeout(unsigned long msectimeout)
{
wxMacStCritical critical ;
{
wxMacStCritical critical ;
return wxCOND_NO_ERROR;
- }
+ }
wxArrayLong m_waiters ;
wxInt32 m_excessSignals ;
SetPriority(m_priority);
}
+ m_state = STATE_NEW;
+
return TRUE;
}
void wxThread::Sleep(unsigned long milliseconds)
{
- clock_t start = clock() ;
- do
- {
- YieldToAnyThread() ;
- } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
+ clock_t start = clock();
+ do
+ {
+ YieldToAnyThread();
+ } while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
}
int wxThread::GetCPUCount()
wxThread::~wxThread()
{
s_threads.Remove( (void*) this ) ;
- delete m_internal;
+ if (m_internal != NULL) {
+ delete m_internal;
+ m_internal = NULL;
+ }
}
// create/start thread
}
}
- // if ( !::GetExitCodeThread(hThread, (LPDWORD)&rc) )
- {
- wxLogLastError("GetExitCodeThread");
-
- rc = (ExitCode)-1;
- }
-
if ( IsDetached() )
{
// if the thread exits normally, this is done in WinThreadStart, but in
delete this;
}
- // wxASSERT_MSG( (DWORD)rc != STILL_ACTIVE,
- // wxT("thread must be already terminated.") );
-
if ( pRc )
*pRc = rc;
#endif
if ( !hasThreadManager )
{
- wxMessageBox( "Error" , "Thread Support is not available on this System" , wxOK ) ;
+ wxLogSysError( wxT("Thread Support is not available on this System") );
return FALSE ;
}
#include "wx/thrimpl.cpp"
#endif // wxUSE_THREADS
-
-// vi:sts=4:sw=4:et