Page 1 of 1

work with a queue

Posted: Thu Feb 09, 2006 4:28 pm
by baert
HI,

I'm working on a way to send messages between two modules of my application.
I was thinking on doing two thread:
on one side, one is writing the message
on another one, it is reading, to keep the things independant.

WIch object could I used to be written/red by the two thread in a secure way ?
does wx provide a sort of "queue" ?

Posted: Thu Feb 09, 2006 6:24 pm
by chris
Hi baert,

isn't that what wxEvent is meant for?
There's an example in samples\event in your wx folder, you may want to have a look at that.

HTH, Chris

Posted: Thu Feb 09, 2006 6:56 pm
by baert
May be I could do that using wxEvent, but if I want to work with my iwn thread, what kind of "queue" do you suggest ?

a wxList could deal with that ?

Posted: Thu Feb 09, 2006 7:05 pm
by chris
I have to admit that I didn't try it, but couldn't you just derive your receiving thread from wxEvtHandler, then push it via wxWindow::PushEventHandler() and simply use the already existing message queue (via PostEvent())?