+void wxConditionInternal::WaitDone()
+{
+ MutexLock lock(m_mutexProtect);
+
+ m_wasSignaled = FALSE;
+ m_nWaiters--;
+}
+
+bool wxConditionInternal::ShouldWait()
+{
+ MutexLock lock(m_mutexProtect);
+
+ if ( m_wasSignaled )
+ {
+ // the condition was signaled before we started to wait, reset the
+ // flag and return
+ m_wasSignaled = FALSE;
+
+ return FALSE;
+ }
+
+ // we start to wait for it
+ m_nWaiters++;
+
+ return TRUE;
+}
+
+bool wxConditionInternal::HasWaiters()
+{
+ MutexLock lock(m_mutexProtect);
+
+ if ( m_nWaiters )
+ {
+ // someone waits for us, signal the condition normally
+ return TRUE;
+ }
+
+ // nobody waits for us and may be never will - so just remember that the
+ // condition was signaled and don't do anything else
+ m_wasSignaled = TRUE;
+
+ return FALSE;
+}
+