if ( !m_mutex )
{
- wxLogLastError(_T("CreateMutex()"));
+ wxLogLastError(wxT("CreateMutex()"));
}
}
{
if ( !::CloseHandle(m_mutex) )
{
- wxLogLastError(_T("CloseHandle(mutex)"));
+ wxLogLastError(wxT("CloseHandle(mutex)"));
}
}
}
case WAIT_ABANDONED:
// the previous caller died without releasing the mutex, so even
// though we did get it, log a message about this
- wxLogDebug(_T("WaitForSingleObject() returned WAIT_ABANDONED"));
+ wxLogDebug(wxT("WaitForSingleObject() returned WAIT_ABANDONED"));
// fall through
case WAIT_OBJECT_0:
// fall through
case WAIT_FAILED:
- wxLogLastError(_T("WaitForSingleObject(mutex)"));
+ wxLogLastError(wxT("WaitForSingleObject(mutex)"));
return wxMUTEX_MISC_ERROR;
}
if ( !::ReleaseMutex(m_mutex) )
{
- wxLogLastError(_T("ReleaseMutex()"));
+ wxLogLastError(wxT("ReleaseMutex()"));
return wxMUTEX_MISC_ERROR;
}
#endif
if ( !m_semaphore )
{
- wxLogLastError(_T("CreateSemaphore()"));
+ wxLogLastError(wxT("CreateSemaphore()"));
}
}
{
if ( !::CloseHandle(m_semaphore) )
{
- wxLogLastError(_T("CloseHandle(semaphore)"));
+ wxLogLastError(wxT("CloseHandle(semaphore)"));
}
}
}
return wxSEMA_TIMEOUT;
default:
- wxLogLastError(_T("WaitForSingleObject(semaphore)"));
+ wxLogLastError(wxT("WaitForSingleObject(semaphore)"));
}
return wxSEMA_MISC_ERROR;
}
else
{
- wxLogLastError(_T("ReleaseSemaphore"));
+ wxLogLastError(wxT("ReleaseSemaphore"));
return wxSEMA_MISC_ERROR;
}
}
bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
{
wxASSERT_MSG( m_state == STATE_NEW && !m_hThread,
- _T("Create()ing thread twice?") );
+ wxT("Create()ing thread twice?") );
// for compilers which have it, we should use C RTL function for thread
// creation instead of Win32 API one because otherwise we will have memory
#ifdef __WXWINCE__
return false;
#else
- 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 )
DWORD_PTR dwProcMask, dwSysMask;
if ( ::GetProcessAffinityMask(hProcess, &dwProcMask, &dwSysMask) == 0 )
{
- wxLogLastError(_T("GetProcessAffinityMask"));
+ wxLogLastError(wxT("GetProcessAffinityMask"));
return false;
}
// could we set all bits?
if ( level != 0 )
{
- wxLogDebug(_T("bad level %u in wxThread::SetConcurrency()"), level);
+ wxLogDebug(wxT("bad level %u in wxThread::SetConcurrency()"), level);
return false;
}
if ( !pfnSetProcessAffinityMask )
{
- HMODULE hModKernel = ::LoadLibrary(_T("kernel32"));
+ HMODULE hModKernel = ::LoadLibrary(wxT("kernel32"));
if ( hModKernel )
{
pfnSetProcessAffinityMask = (SETPROCESSAFFINITYMASK)
// we've discovered a MT version of Win9x!
wxASSERT_MSG( pfnSetProcessAffinityMask,
- _T("this system has several CPUs but no SetProcessAffinityMask function?") );
+ wxT("this system has several CPUs but no SetProcessAffinityMask function?") );
}
if ( !pfnSetProcessAffinityMask )
if ( pfnSetProcessAffinityMask(hProcess, dwProcMask) == 0 )
{
- wxLogLastError(_T("SetProcessAffinityMask"));
+ wxLogLastError(wxT("SetProcessAffinityMask"));
return false;
}
{
wxCriticalSectionLocker lock(m_critsect);
- if ( m_internal->GetState() != STATE_NEW )
- {
- // actually, it may be almost any state at all, not only STATE_RUNNING
- return wxTHREAD_RUNNING;
- }
+ wxCHECK_MSG( m_internal->GetState() == STATE_NEW, wxTHREAD_RUNNING,
+ wxT("thread may only be started once after Create()") );
// the thread has just been created and is still suspended - let it run
return Resume();
// 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(), rc,
- _T("wxThread::Wait(): can't wait for detached thread") );
+ wxT("wxThread::Wait(): can't wait for detached thread") );
(void)m_internal->WaitForTerminate(m_critsect, &rc);
wxLogLastError(wxT("TlsFree failed."));
}
- delete gs_critsectThreadDelete;
- gs_critsectThreadDelete = NULL;
+ wxDELETE(gs_critsectThreadDelete);
if ( gs_critsectGui )
{
gs_critsectGui->Leave();
- delete gs_critsectGui;
- gs_critsectGui = NULL;
+ wxDELETE(gs_critsectGui);
}
- delete gs_critsectWaitingForGui;
- gs_critsectWaitingForGui = NULL;
+ wxDELETE(gs_critsectWaitingForGui);
}
// ----------------------------------------------------------------------------