Hi,
I am after an example of how to set up 2+ threads and have some kind of thread safe task-que that both threads can monitor for tasks an act on them.
A little background info, each thread will be an open socket connection, and the que (if possible a vector) will contain tasks for the thread/connection to perform.
I would like to use C++ for this, so will probably be using the boost.threads library.
I just have never understood how to set up a system with multiple threads monitoring a single que. Would really appreciate it if anyone has a small skeleton program demonstrating how this sort approach works?
Thanks a lot,
Jack
I am after an example of how to set up 2+ threads and have some kind of thread safe task-que that both threads can monitor for tasks an act on them.
A little background info, each thread will be an open socket connection, and the que (if possible a vector) will contain tasks for the thread/connection to perform.
I would like to use C++ for this, so will probably be using the boost.threads library.
I just have never understood how to set up a system with multiple threads monitoring a single que. Would really appreciate it if anyone has a small skeleton program demonstrating how this sort approach works?
Thanks a lot,
Jack