]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Unicode needs the 'experimental' printf, so define it if wxUSE_UNICODE
[wxWidgets.git] / src / msw / thread.cpp
index 8028e928e1dee979a0dbc5850a227ac5743d418d..1b26944ae7a0dbf86f2e662f2156896bf4c85dfc 100644 (file)
@@ -257,26 +257,21 @@ private:
 
 wxCriticalSection::wxCriticalSection()
 {
-    m_critsect = NULL;
+    m_critsect = new wxCriticalSectionInternal;
 }
 
 wxCriticalSection::~wxCriticalSection()
 {
-    if ( m_critsect )
-        delete m_critsect;
+    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);
 }
 
@@ -445,6 +440,10 @@ bool wxThread::IsMain()
     return ::GetCurrentThreadId() == s_idMainThread;
 }
 
+#ifdef Yield
+    #undef Yield
+#endif
+
 void wxThread::Yield()
 {
     // 0 argument to Sleep() is special
@@ -665,6 +664,13 @@ bool wxThread::IsAlive() const
            (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);