/////////////////////////////////////////////////////////////////////////////
-// Name: threadpsx.cpp
+// Name: src/unix/threadpsx.cpp
// Purpose: wxThread (Posix) Implementation
// Author: Original from Wolfram Gloger/Guilhem Lavaux
// Modified by: K. S. Sreeram (2002): POSIXified wxCondition, added wxSemaphore
#if wxUSE_THREADS
#include "wx/thread.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/dynarray.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/utils.h"
+ #include "wx/timer.h"
+#endif
+
#include "wx/module.h"
-#include "wx/utils.h"
-#include "wx/log.h"
-#include "wx/intl.h"
-#include "wx/dynarray.h"
-#include "wx/timer.h"
#include "wx/stopwatch.h"
#include <stdio.h>
{
wxFAIL_MSG( _T("wxSemaphore: invalid initial or maximal count") );
- m_isOk = FALSE;
+ m_isOk = false;
}
else
{
pthread_t GetId() const { return m_threadId; }
pthread_t *GetIdPtr() { return &m_threadId; }
// "cancelled" flag
- void SetCancelFlag() { m_cancelled = TRUE; }
+ void SetCancelFlag() { m_cancelled = true; }
bool WasCancelled() const { return m_cancelled; }
// exit code
void SetExitCode(wxThread::ExitCode exitcode) { m_exitcode = exitcode; }
{
wxCriticalSectionLocker lock(m_csJoinFlag);
- m_shouldBeJoined = FALSE;
- m_isDetached = TRUE;
+ m_shouldBeJoined = false;
+ m_isDetached = true;
}
#ifdef wxHAVE_PTHREAD_CLEANUP
wxThreadInternal::wxThreadInternal()
{
m_state = STATE_NEW;
- m_cancelled = FALSE;
+ m_cancelled = false;
m_prio = WXTHREAD_DEFAULT_PRIORITY;
m_threadId = 0;
m_exitcode = 0;
- // set to TRUE only when the thread starts waiting on m_semSuspend
- m_isPaused = FALSE;
+ // set to true only when the thread starts waiting on m_semSuspend
+ m_isPaused = false;
// defaults for joinable threads
- m_shouldBeJoined = TRUE;
- m_isDetached = FALSE;
+ m_shouldBeJoined = true;
+ m_isDetached = false;
}
wxThreadInternal::~wxThreadInternal()
wxLogError(_("Failed to join a thread, potential memory leak detected - please restart the program"));
}
- m_shouldBeJoined = FALSE;
+ m_shouldBeJoined = false;
}
}
m_semSuspend.Post();
// reset the flag
- SetReallyPaused(FALSE);
+ SetReallyPaused(false);
}
else
{
if ( m_internal->GetState() == STATE_PAUSED )
{
- m_internal->SetReallyPaused(TRUE);
+ m_internal->SetReallyPaused(true);
// leave the crit section or the other threads will stop too if they
// try to call any of (seemingly harmless) IsXXX() functions while we
{
case STATE_RUNNING:
case STATE_PAUSED:
- return TRUE;
+ return true;
default:
- return FALSE;
+ return false;
}
}
{
wxLogSysError(rc, _("Thread module initialization failed: failed to create thread key"));
- return FALSE;
+ return false;
}
gs_tidMain = pthread_self();
gs_mutexDeleteThread = new wxMutex();
gs_condAllDeleted = new wxCondition( *gs_mutexDeleteThread );
- return TRUE;
+ return true;
}
void wxThreadModule::OnExit()
#include "wx/thrimpl.cpp"
#endif // wxUSE_THREADS
-