Boost logo

Boost :

From: Jive Dadson (jdadson_at_[hidden])
Date: 2002-05-23 15:05:13


First, please allow me a short paragraph to introduce myself and explain
where I'm coming from. I am a newbie in these Boost parts. I have been
reading the list for about two months, but I had never posted before I
started this "Semaphores?" thread a day or two ago. I am a long time
C++ user. I attended the first C++ conference in the mid-eighties
(don't remember the year). I even entered into some discussions with
the onlie begetter, Bjarne Stroustrup (in person and through email), on
how C++ might be defined. However, over the years, I have not always
kept completely up to date on C++. Right now, I am catching up on
generic programming, among other things.

"Jive Dadson" is a _nom du net_ that I use to protect against leaking
business plans when discussing technical issues on the internet. If I
exchange email with one of you, I'll use the name my momma gave me,
assuming I remember to change the setting in the email program.

Apparently I missed something in the "Semaphores?" thread. I subscribe
to the digest version of the list. I see my original question, then the
next thing I see appears to be the middle of some raging "semaphores
considered harmful" war. There's an extended analogy to racism.
Gadzooks!

I find this odd, as I can't think of any subject I would have considered
more bland and uncontroversial. I've been happily using semaphores
since 1979. Naturally, I have my own abstraction of semaphores,
implemented on two platforms: Win32 and a lightweight realtime OS called
OnTime RTOS 32. I also have a small assortment of intertask
communication FIFO's. I just thought it might be nice to use "blessed"
versions of those things. It appears they are as accursed as they are
blessed.

Bill Kempf wrote:
>From: "Jive Dadson" <jdadson_at_[hidden]>
>> Are there any plans to add semaphores to the boost threads library? Or
>> are they already there and I missed them? How about timer events and
>> such? Waiting on any of a list of events?
>
>Semaphores were in the submission library, but were removed as "too
>dangerous". See the rationale page.
>

I looked at the rationale page. The word "semaphore" does not occur.
Are you refering to the section on "event queues" and whatnot? I will
read up, and attempt to find out what all the brouhaha is about.
       
>That said, semaphores aren't strictly "missing forever". I plan to address
>this at some point with more research into the pros/cons.
>
>> Applications I write and maintain use semaphores to moderate
>> inter-thread communication via shared FIFO's. Perhaps Boost has plans
>> for implementing that higher level concept.
>
>No plans for this today. I currently believe that such event queues are too
>high level and beyond the scope of Boost.Threads (for one thing, they are
>useful even with ST applications).

Did not grok. The sort of thing I am talking about is a general purpose
interthread message FIFO. Containers of that type are as natural in
realtime systems as linked lists and dictionaries are in batch
programming.

What are ST applications? Single thread applications? The type of
semaphore controlled FIFO I am thinking of cannot be used in a single
thread application. It makes no sense for a thread to suspend until a
dropbox has something in it, if there is no other thread to put
something in the dropbox.

>I've tried to encourage a few others to
>provide such a queue as a separate Boost library submission ...

Ah. You suggest putting it in Boost, but not in Boost.Threads.
Bookkeeping aside, you still need semaphores, or monitors, or something
equivalent. I implemented the interthread queues using a mutex and one
or two semaphores. Without semaphores or something like them, you wind
up spinning, which for me is right out.

> ... however, and
>still think that's a very good idea for someone to take on.

And be called a racist??? :-)

Jive


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