+ // treat time out (-1 return value) as normal successful return so that
+ // OnNextIteration() is called
+ return !!DispatchTimeout(TIMEOUT);
+}
+
+int wxGUIEventLoop::DispatchTimeout(unsigned long timeout)
+{
+ wxCHECK_MSG( ms_buffer, 0, "invalid event buffer" );
+
+ // release the GUI mutex so that other threads have a chance to post
+ // events:
+ wxMutexGuiLeave();
+
+ bool rv = ms_buffer->WaitForEventWithTimeout(0, timeout);
+
+ // and acquire it back before calling any event handlers:
+ wxMutexGuiEnter();