Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-06-04 18:03:25


Nicolas Fleury said:
> William E. Kempf wrote:
>> Stefan Seefeld said:
>>>As boost doesn't, there must clearly be other reasons for them not to
>>> do that.
>>
>> There is, but the explanations are long and quite complex. That's why
>> the FAQ points you at a seminal paper on the subject, rather than
>> attempting
>
> Correct me if I'm wrong, but isn't the FAQ pointing to a seminal paper
> only when justiying the absence of events, not semaphores?

Hmm... my mistake. The reference was missed in the FAQ. I'll have to
correct this, but it will take me a bit, as I'm busy with other things.

> What is the paper you have in mind to justify the absence of semaphores?
>
> I would like very much to understand and be convinced. It would also
> be nice if the #10 of the FAQ would point to this paper.
>
>> to explain it. Like I've said in numerous arguments about the Event
>> concept, the problem with the concept isn't that it's broken or
>> unusable, only that it's difficult to actually use correctly. Most
>> users think their code is correct, when in fact they have race
>> conditions waiting to bite them. When Mutexes and Condition variables
>> provide everything that Semaphores and Events do, but in a way that's
>> easier to use correctly, the choice to not include Event's or
>> Semaphore's is reasonable.
>
> I highly respect and esteem people working on boost, and I strongly
> expect the removal of semaphore was reasonable. It's just that the
> current explanation I see is not convincing for me and probably others:
> "Semaphore was removed as too error prone. The same effect can be
> achieved with greater safety by the combination of a mutex and a
> condition variable." I guess the answer is in the papers referred in
> the events versus conditions question; it's just that people coming from
> Posix environments would not care about the event topic and would feel
> the semaphore absence justification is incomplete.

As Alexander points out, some of the justification is similar to the
justification of events. After a semaphore is signaled, it's the burden
of the user to ensure proper synchronization of any shared resources. In
most cases this is difficult to do correctly at best.

-- 
William E. Kempf

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