-wxCondition::wxCondition()
-{
- m_internal = new wxConditionInternal;
-}
-
-wxCondition::~wxCondition()
-{
- delete m_internal;
-}
-
-void wxCondition::Wait()
-{
- (void)m_internal->Wait(0xFFFFFFFFL );
-}
-
-bool wxCondition::Wait(unsigned long sec,
- unsigned long nsec)
-{
- return m_internal->Wait(sec*1000 + nsec/1000000);
-}
-
-void wxCondition::Signal()
-{
- // set the event to signaled: if a thread is already waiting on it, it will
- // be woken up, otherwise the event will remain in the signaled state until
- // someone waits on it. In any case, the system will return it to a non
- // signalled state afterwards. If multiple threads are waiting, only one
- // will be woken up.
- m_internal->Signal() ;
-}
-
-void wxCondition::Broadcast()
-{
- // this works because all these threads are already waiting and so each
- // SetEvent() inside Signal() is really a PulseEvent() because the event
- // state is immediately returned to non-signaled
- for ( int i = 0; i < m_internal->m_waiters.Count(); i++ )
- {
- Signal();
- }
-}
-