X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f298361db63eb8d8f427538b2ff233ce36d08a9..4706252347b3a729552753c07ea41cc9ba9cd19d:/src/msw/thread.cpp?ds=sidebyside diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 4d58a67d77..257c13f4aa 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -4,7 +4,6 @@ // Author: Original from Wolfram Gloger/Guilhem Lavaux // Modified by: Vadim Zeitlin to make it work :-) // Created: 04/22/98 -// RCS-ID: $Id$ // Copyright: (c) Wolfram Gloger (1996, 1997), Guilhem Lavaux (1998); // Vadim Zeitlin (1999-2002) // Licence: wxWindows licence @@ -905,7 +904,8 @@ bool wxThreadInternal::Suspend() DWORD nSuspendCount = ::SuspendThread(m_hThread); if ( nSuspendCount == (DWORD)-1 ) { - wxLogSysError(_("Cannot suspend thread %lx"), GetThreadId(m_hThread)); + wxLogSysError(_("Cannot suspend thread %lx"), + static_cast(wxPtrToUInt(m_hThread))); return false; } @@ -920,7 +920,8 @@ bool wxThreadInternal::Resume() DWORD nSuspendCount = ::ResumeThread(m_hThread); if ( nSuspendCount == (DWORD)-1 ) { - wxLogSysError(_("Cannot resume thread %lx"), GetThreadId(m_hThread)); + wxLogSysError(_("Cannot resume thread %lx"), + static_cast(wxPtrToUInt(m_hThread))); return false; } @@ -1105,6 +1106,14 @@ wxThreadError wxThread::Run() { wxCriticalSectionLocker lock(m_critsect); + // Create the thread if it wasn't created yet with an explicit + // Create() call: + if ( !m_internal->GetHandle() ) + { + if ( !m_internal->Create(this, 0) ) + return wxTHREAD_NO_RESOURCE; + } + wxCHECK_MSG( m_internal->GetState() == STATE_NEW, wxTHREAD_RUNNING, wxT("thread may only be started once after Create()") );