23 Dec
2004
23 Dec
'04
1:29 p.m.
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.
Consider doing away with the semaphore and integrate the condvar, mutex
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... 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.