From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-13 15:44:14
From: "Beman Dawes" <bdawes_at_[hidden]>
> If thread_func() slows way down relative to notifyThread(), lots of
> get lost. That isn't a problem in this particular program, but it means
> that the queue grows, and eventually runs out of resources unless that's
> internally protected against. There is a lot of opportunity for error.
The alternative is to have notifyThread() block. Depending on the situation
this may not be acceptable; sometimes the whole point of having worker
threads is to leave the main thread responsive. Another point to consider is
that the consumer/worker thread may be faster _on average_ than the
producer/main thread but sometimes slow down unpredictably, thus blocking
the producer unnecessarily.
All this is quite common in computer games. :-)
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk