
Steven Woody wrote:
hi,
i am doing a job and considering if boost.thread can help.
...
in breif, you can think my code in a way of producer/consumer pattern. the producer is a rouine which will be called by many threads ( which are actaully connected sockets created by a listening socket ), and the consumer routine will be called by another thread ( which is actually GUI's main thread ). what i expected is:
1, only one producer can write to the shared data; 2, when a producer is writting, other producers have to busy waiting; and the GUI thread should immediately exit; 3, when GUI thread is reading, no producer can write to the shared data;
From the sound of what you're trying to do then yes. This page shows how to make a queue and add and remove items from it. http://www.boostcookbook.com/Recipe:/1234841 K