X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..fb8d7eb7a880f1f2e32d8830f9c5e12b2536e05f:/src/os2/thread.cpp diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index e4d1387488..b17b17cb83 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -114,7 +114,7 @@ wxMutexInternal::wxMutexInternal(wxMutexType WXUNUSED(eMutexType)) APIRET ulrc = ::DosCreateMutexSem(NULL, &m_vMutex, 0L, FALSE); if (ulrc != 0) { - wxLogSysError(_("Can not create mutex.")); + wxLogSysError(_("Cannot create mutex.")); m_vMutex = NULL; } } @@ -354,7 +354,7 @@ public: { m_hThread = 0; m_eState = STATE_NEW; - m_nPriority = WXTHREAD_DEFAULT_PRIORITY; + m_nPriority = wxPRIORITY_DEFAULT; } ~wxThreadInternal() @@ -497,7 +497,7 @@ bool wxThreadInternal::Create( wxThread* pThread, return false; } m_hThread = tid; - if (m_nPriority != WXTHREAD_DEFAULT_PRIORITY) + if (m_nPriority != wxPRIORITY_DEFAULT) { SetPriority(m_nPriority); } @@ -511,7 +511,7 @@ bool wxThreadInternal::Suspend() if (ulrc != 0) { - wxLogSysError(_("Can not suspend thread %lu"), m_hThread); + wxLogSysError(_("Cannot suspend thread %lu"), m_hThread); return false; } m_eState = STATE_PAUSED; @@ -525,7 +525,7 @@ bool wxThreadInternal::Resume() if (ulrc != 0) { - wxLogSysError(_("Can not resume thread %lu"), m_hThread); + wxLogSysError(_("Cannot resume thread %lu"), m_hThread); return false; } @@ -626,6 +626,14 @@ wxThreadError wxThread::Run() { wxCriticalSectionLocker lock((wxCriticalSection &)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; + } + if ( m_internal->GetState() != STATE_NEW ) { // actually, it may be almost any state at all, not only STATE_RUNNING @@ -661,18 +669,18 @@ wxThreadError wxThread::Resume() // stopping thread // --------------- -wxThread::ExitCode wxThread::Wait() +wxThread::ExitCode wxThread::Wait(wxThreadWait waitMode) { // although under Windows we can wait for any thread, it's an error to // wait for a detached one in wxWin API wxCHECK_MSG( !IsDetached(), (ExitCode)-1, wxT("can't wait for detached thread") ); ExitCode rc = (ExitCode)-1; - (void)Delete(&rc); + (void)Delete(&rc, waitMode); return(rc); } -wxThreadError wxThread::Delete(ExitCode *pRc) +wxThreadError wxThread::Delete(ExitCode *pRc, wxThreadWait WXUNUSED(waitMode)) { ExitCode rc = 0;