Thread, communicate data from main program to thread(s) and back

Hi, i've set up an example of a main program that starts two threads and then sends some data to those thread(s). When the thread(s) have processed the data they should notify the main program/thread and wait for new data. I'd like to make sure that what i write is also portable and does not just by chance work on the platform i use. boost::condition seems to be the right thing to look at, is that right? Is there some example for data communication between threads available? Best regards, Torsten.

Hi,,
On 9/23/07, Torsten Mohr
Is there some example for data communication between threads available?
I am guessing, BOOST::ASIO might have such a thing. Your description looks more like a main thread dispatching work to worker threads (pool of threads) and communication between them. I am newbie to ASIO but have heard it has lot of potential for such tasks (and I have a similar need). -dky -- Dhruva Krishnamurthy Contents reflect my personal views only!

Torsten Mohr wrote:
i've set up an example of a main program that starts two threads and then sends some data to those thread(s). When the thread(s) have processed the data they should notify the main program/thread and wait for new data.
I'd like to make sure that what i write is also portable and does not just by chance work on the platform i use.
boost::condition seems to be the right thing to look at, is that right?
Is there some example for data communication between threads available?
I've just posted a recipe that implements workers executing queued jobs and passing results back using futures. I can't directly answer for the portability of the implementation (we've only used it on MSVC 7.1 and MSVC 8.1), but the thread handling should be as portable as the underlying Boost libraries. http://www.boostcookbook.com/Recipe:/Worker%20threads%20returning%20futures K
participants (3)
-
dhruva
-
Kirit Sælensminde
-
Torsten Mohr