|
Boost Users : |
From: Steven Woody (narkewoody_at_[hidden])
Date: 2007-10-01 11:54:19
hi,
i am doing a job and considering if boost.thread can help.
what i am doing is writing some code for other one's use. my code will
be called by many threads, and accessing some shared data. my problem
is how to keep my code thread-safe. i have no way to control how those
other threads were created ( actually, those had already done by
another team using windows MFC, and, for some reasons, my code can not
use MFC, is has to be portable bwteen Linux and Windows ).
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;
to my problem, does the boost.thread can help?
thanks in advance.
-- woody then sun rose thinly from the sea and the old man could see the other boats, low on the water and well in toward the shore, spread out across the current.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net