Boost logo

Boost :

From: Jive Dadson (jdadson_at_[hidden])
Date: 2002-05-23 16:49:38


FYI, one of the inter-thread FIFO objects I implemented is quite like
the one listed in

   
http://www.boost.org/libs/thread/doc/condition.html#class-condition-synopsis

with one important difference: There are no while-loops. In the version
I
am using, the buffer_not_full and buffer_not_empty objects are counting
semaphores. I also separated out the concepts of mutex-locking the
object
(it_fifo<TYPE>) and semaphore-waiting/signaling (it_buffer<TYPE>). In
other
words, the class that is equivalent to the "bounded_buffer" type in the
example (except for the polling loops) is called "it_buffer<int>" and is
implemented in terms of class semaphore and a mutex-locked class called
"it_fifo<int>". Class it_fifo<int> is implemented in terms of
class mutex and std::queue<int>.

I first wrote code for an object like it_buffer in 1979, and it was old
news even then.

Having done a lot of realtime programming, I am keenly aware of the
dangers of race
conditions. I've put systems into some scary applications, like nuclear
power plants,
oil platforms, and gasoline pumps - things that can go BOOM! You want
to do those right.
Nevertheless, I don't go along with the argument that useful features
should be omitted from
development systems because a programmer can screw up when using them.
A friend
of mine has a saying: "You can't make a system fool-proof, because fools
are ingenious."

Jive


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk