// Author: Original from Wolfram Gloger/Guilhem Lavaux/David Webster
// Modified by: Stefan Neis
// Created: 04/22/98
-// RCS-ID: $Id$
// Copyright: (c) Stefan Neis (2003)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
APIRET ulrc = ::DosCreateMutexSem(NULL, &m_vMutex, 0L, FALSE);
if (ulrc != 0)
{
- wxLogSysError(_("Can not create mutex."));
+ wxLogSysError(_("Cannot create mutex."));
m_vMutex = NULL;
}
}
if (m_vMutex)
{
if (::DosCloseMutexSem(m_vMutex))
- wxLogLastError(_T("DosCloseMutexSem(mutex)"));
+ {
+ wxLogLastError(wxT("DosCloseMutexSem(mutex)"));
+ }
}
}
ulrc = ::DosCreateMutexSem(NULL, &m_vMutex, 0L, FALSE);
if (ulrc != 0)
{
- wxLogLastError(_T("DosCreateMutexSem()"));
+ wxLogLastError(wxT("DosCreateMutexSem()"));
m_vMutex = NULL;
m_vEvent = NULL;
return;
ulrc = ::DosCreateEventSem(NULL, &m_vEvent, 0L, FALSE);
if ( ulrc != 0)
{
- wxLogLastError(_T("DosCreateEventSem()"));
+ wxLogLastError(wxT("DosCreateEventSem()"));
::DosCloseMutexSem(m_vMutex);
m_vMutex = NULL;
m_vEvent = NULL;
{
if ( ::DosCloseEventSem(m_vEvent) )
{
- wxLogLastError(_T("DosCloseEventSem(semaphore)"));
+ wxLogLastError(wxT("DosCloseEventSem(semaphore)"));
}
if ( ::DosCloseMutexSem(m_vMutex) )
{
- wxLogLastError(_T("DosCloseMutexSem(semaphore)"));
+ wxLogLastError(wxT("DosCloseMutexSem(semaphore)"));
}
else
m_vEvent = NULL;
return wxSEMA_TIMEOUT;
default:
- wxLogLastError(_T("DosWaitEventSem(semaphore)"));
+ wxLogLastError(wxT("DosWaitEventSem(semaphore)"));
return wxSEMA_MISC_ERROR;
}
ulrc = :: DosRequestMutexSem(m_vMutex, ulMilliseconds);
return wxSEMA_OVERFLOW;
if ( ulrc != NO_ERROR && ulrc != ERROR_ALREADY_POSTED )
{
- wxLogLastError(_T("DosPostEventSem(semaphore)"));
+ wxLogLastError(wxT("DosPostEventSem(semaphore)"));
return wxSEMA_MISC_ERROR;
}
{
m_hThread = 0;
m_eState = STATE_NEW;
- m_nPriority = WXTHREAD_DEFAULT_PRIORITY;
+ m_nPriority = wxPRIORITY_DEFAULT;
}
~wxThreadInternal()
return false;
}
m_hThread = tid;
- if (m_nPriority != WXTHREAD_DEFAULT_PRIORITY)
+ if (m_nPriority != wxPRIORITY_DEFAULT)
{
SetPriority(m_nPriority);
}
if (ulrc != 0)
{
- wxLogSysError(_("Can not suspend thread %lu"), m_hThread);
+ wxLogSysError(_("Cannot suspend thread %lu"), m_hThread);
return false;
}
m_eState = STATE_PAUSED;
if (ulrc != 0)
{
- wxLogSysError(_("Can not resume thread %lu"), m_hThread);
+ wxLogSysError(_("Cannot resume thread %lu"), m_hThread);
return false;
}
bool wxThread::SetConcurrency(size_t level)
{
- wxASSERT_MSG( IsMain(), _T("should only be called from the main thread") );
+ wxASSERT_MSG( IsMain(), wxT("should only be called from the main thread") );
// ok only for the default one
if ( level == 0 )
{
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
// 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,
- _T("can't wait for detached thread") );
+ 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;