Inter-Thread Communication.

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Inter-Thread Communication.

Post by rafae11 »

I have three threads a main thread and two worker threads.
Worker thread one just polls and processes serial comms data
after its done processing it sends information back to the main thread.

the 2nd worker thread just runs a simple finite state machine
how do i pass the information to the worker thread from the main thread?

i don't know how to pass information to a thread that is already runninng.
i need to pass information to my 2nd worker thread in order for the states to change.

i've been using this as reference
http://wiki.wxwidgets.org/Inter-Thread_ ... munication

could you please give me a simple example on how to do this thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Inter-Thread Communication.

Post by doublemax »

The link you posted already contains everything you need. When multithreading is involved, there are hardly any really simple samples.

You should take a look at wxMessageQueue:
http://docs.wxwidgets.org/trunk/classwx ... _01_4.html
Use the source, Luke!
rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Re: Inter-Thread Communication.

Post by rafae11 »

thanks.
i decided just to use globals with locks.
Post Reply