Boost logo

Boost :

Subject: Re: [boost] [thread] semaphore
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2013-09-18 13:04:48


On Wed, Sep 18, 2013 at 12:33 PM, Jonathan Wakely
<jwakely.boost_at_[hidden]>wrote:

> On 18 September 2013 17:28, Gottlob Frege wrote:
> > But it still doesn't make it easy to use. It might have been easier to
> > somehow wrap the lock and CV together (and a lambda for the condition?)
> and
> > tell people to make sure they also lock the same CV+lock thing when
> > pushing/pulling from the queue.
>
> I think the problem with wrapping them together is that the binding of
> the three things is dynamic, not static. It's OK to use the same CV
> with different mutexes (as long as no waits using different mutexes
> ever overlap) although doing so correctly can be tricky :)
>
>
I wouldn't let that stop a wrapping - most cases don't need that, and you
could still use "raw" CVs and locks for that.

I think it is more likely that the "devil is in the details". If we
actually sat down and tried to make a simple+powerful class, we would find
the gotchas. (Tends to happen with simple+powerful.)

But it might be worth trying.


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