X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad816ba53975de78ea29acdc40f05217137c8ad3..8f2b1cfd3942412889d9f7e2fd2efe27e2d049c1:/src/mac/carbon/thread.cpp?ds=sidebyside diff --git a/src/mac/carbon/thread.cpp b/src/mac/carbon/thread.cpp index 5ce510da31..8c64c8818a 100644 --- a/src/mac/carbon/thread.cpp +++ b/src/mac/carbon/thread.cpp @@ -99,7 +99,7 @@ public: { 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); } } @@ -433,6 +433,8 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) SetPriority(m_priority); } + m_state = STATE_NEW; + return TRUE; } @@ -523,11 +525,11 @@ void wxThread::Yield() 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() @@ -576,7 +578,10 @@ wxThread::wxThread(wxThreadKind kind) wxThread::~wxThread() { s_threads.Remove( (void*) this ) ; - delete m_internal; + if (m_internal != NULL) { + delete m_internal; + m_internal = NULL; + } } // create/start thread @@ -711,13 +716,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) } } - // if ( !::GetExitCodeThread(hThread, (LPDWORD)&rc) ) - { - wxLogLastError("GetExitCodeThread"); - - rc = (ExitCode)-1; - } - if ( IsDetached() ) { // if the thread exits normally, this is done in WinThreadStart, but in @@ -727,9 +725,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) delete this; } - // wxASSERT_MSG( (DWORD)rc != STILL_ACTIVE, - // wxT("thread must be already terminated.") ); - if ( pRc ) *pRc = rc; @@ -849,7 +844,7 @@ bool wxThreadModule::OnInit() #endif if ( !hasThreadManager ) { - wxMessageBox( "Error" , "Thread Support is not available on this System" , wxOK ) ; + wxMessageBox( wxT("Error") , wxT("Thread Support is not available on this System") , wxOK ) ; return FALSE ; } @@ -899,5 +894,3 @@ bool WXDLLEXPORT wxIsWaitingForThread() #include "wx/thrimpl.cpp" #endif // wxUSE_THREADS - -// vi:sts=4:sw=4:et