Clear pending events
Maximilian Matthé
Maxi.Matthe at web.de
Mon Oct 22 01:16:14 PDT 2007
Hello!
I have the following problem: I have a heavy calculation that is split
into two threads. Both threads add pending events to an event handler
class that updates a progress dialog. So I can show the progress of the
calculation.
Both threads are joinable, I create them via new in a function, wait for
them and delete the threads. The handler is created as a stack variable
just in that function. So, when the threads are done, the handler is
destructed automatically. But it seems, that there are pending events in
the event loop of the application which can only be handled by the stack
event handler (its a user defined event type). Thus the message queue is
blocked by those events, and e.g. wxLogError does not show messageboxes
but waits until the end of the program.
So my question is: How can i clear the messageloop from those pending
events? I tried this: while(app->Pending()) app->Dispatch(); but this
had no effect.
I dont want to create the handler with new, becuase i only need it in
this function, and nobody could delete it afterwards.
I hope you can help
Max
More information about the wx-users
mailing list