wxCriticalSection::wxCriticalSection()
{
- m_critsect = NULL;
+ m_critsect = new wxCriticalSectionInternal;
}
wxCriticalSection::~wxCriticalSection()
{
- wxASSERT_MSG( !m_critsect, "Forgot to Leave() critical section" );
+ delete m_critsect;
}
void wxCriticalSection::Enter()
{
- m_critsect = new wxCriticalSectionInternal;
-
::EnterCriticalSection(*m_critsect);
}
void wxCriticalSection::Leave()
{
- wxCHECK_RET( m_critsect, "Leave() without matching Enter()" );
-
::LeaveCriticalSection(*m_critsect);
-
- delete m_critsect;
- m_critsect = NULL;
}
// ----------------------------------------------------------------------------
return ::GetCurrentThreadId() == s_idMainThread;
}
+#ifdef Yield
+ #undef Yield
+#endif
+
void wxThread::Yield()
{
// 0 argument to Sleep() is special
(p_internal->GetState() == STATE_PAUSED);
}
+bool wxThread::IsPaused() const
+{
+ wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect);
+
+ return (p_internal->GetState() == STATE_PAUSED);
+}
+
bool wxThread::TestDestroy()
{
wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect);