Boost logo

Boost Users :

From: Amerio (amerio_at_[hidden])
Date: 2004-12-23 08:29:09


> Yet another tought:
> When you have returned from your wait function you will need another lock
to
> access your queue in order to retrieve an entry. On the other hand when
> returning
> from m_cond.wait you are the holder of lock. So if you use the m_mutex
> also to
> protect your queue you save one locking operation.

I thought about this, too. Yet, the boost doc says that wait() will UNLOCK
then RELOCK the mutex. Couldn't it be that in between someone else take the
lock ?
The doc is quite fuzzy around this...

> Consider doing away with the semaphore and integrate the condvar, mutex
pair
> into your queue.
> Think of a semaphore only beeing a special case of
> (condvar,mutex,counter) triple.

I may try this approach. Thank you.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net