+ void 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.
+ if ( !::SetEvent(m_hEvent) )
+ {
+ wxLogLastError(wxT("SetEvent"));
+ }
+ }
+
+ void 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 ( LONG n = 0; n < m_nWaiters; n++ )
+ {
+ Signal();
+ }
+ }
+