Boost logo

Boost :

From: Jon Jagger (jon.jagger_at_[hidden])
Date: 2000-08-02 01:48:35


We had some interesting discussions going on about a thread library
for boost for a while.
[ ... ]
Someone else wanted to start with the primitive types that should be
defined, so I'll start there. The primitives I think that should be
defined as class objects:

thread
mutex
semaphore
condition

That's it. No more, no less.
[ ... ]

The types I've left out include events, gates and read/write locks
(probably others as well, though these are all that I can think of).
[ ... ]
Read/write locks are
nice, but their use is honestly restricted enough in my own
experience to be left out. Besides, they aren't hard to build from
the other primitives I've included.
[ ... ]
Comments?

     I think it's easy to forget that read/write locks
     (for example) are easy for you to build from other
     primitives because you have experience. Many others
     would find it very difficult, which in my book is a
     strong argument for including them in the library.

     I'm also reminded of the old primitive/idiomatic
     duality. For example, you don't _need_ empty()
     in a container class, you could use length()==0.
     But empty() is provided because it's sufficiently
     common and hence idiomatic. So, are read/write locks
     sufficiently common? I think they are. And if
     you don't provide them you have a self-fulfilling
     prophesy that they won't become common...

     Also, I've had experience of using a thread library
     that did not provide them, and because I did not
     have the time (or the inclination) to write my own
     versions I had to work round their absence.

     I feel too that not doing read/write locks is,
     in a sense, a missed const-ness opportunity. Which
     doesn't feel right.

     Lastly, genuine examples of using primitives to
     build higher level classes is a good way to
     test the design and usability of the primitives.

     Just my £0.02

     Jon Jagger

________________________________________________________________________
This message has been checked for all known viruses, by Star Internet,
delivered through the MessageLabs Virus Control Centre.
For further information visit:
http://www.star.net.uk/stats.asp


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