- // constructor & destructor
- wxCondition();
- ~wxCondition();
-
- // Waits indefinitely.
- void Wait(wxMutex& mutex);
- // Waits until a signal is raised or the timeout is elapsed.
- bool Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec);
- // Raises a signal: only one "Waiter" is released.
- void Signal();
- // Broadcasts to all "Waiters".
- void Broadcast();
+ // constructor and destructor
+
+ // Each wxCondition object is associated with with a wxMutex object The
+ // mutex object MUST be locked before calling Wait()
+ wxCondition(wxMutex& mutex);
+
+ // dtor is not virtual, don't use this class polymorphically
+ ~wxCondition();
+
+ // NB: the associated mutex MUST be locked beforehand by the calling thread
+ //
+ // it atomically releases the lock on the associated mutex
+ // and starts waiting to be woken up by a Signal()/Broadcast()
+ // once its signaled, then it will wait until it can reacquire
+ // the lock on the associated mutex object, before returning.
+ void Wait();
+
+ // exactly as Wait() except that it may also return if the specified
+ // timeout ellapses even if the condition hasn't been signalled: in this
+ // case, the return value is FALSE, otherwise (i.e. in case of a normal
+ // return) it is TRUE
+ //
+ // the timeeout parameter specifies a interval that needs to be waited in
+ // milliseconds
+ bool Wait( unsigned long timeout_millis );
+
+ // NB: the associated mutex may or may not be locked by the calling thread
+ //
+ // this method unblocks one thread if any are blocking on the condition.
+ // if no thread is blocking in Wait(), then the signal is NOT remembered
+ // The thread which was blocking on Wait(), will then reacquire the lock
+ // on the associated mutex object before returning
+ void Signal();
+
+ // NB: the associated mutex may or may not be locked by the calling thread
+ //
+ // this method unblocks all threads if any are blocking on the condition.
+ // if no thread is blocking in Wait(), then the signal is NOT remembered
+ // The threads which were blocking on Wait(), will then reacquire the lock
+ // on the associated mutex object before returning.
+ void Broadcast();