Boost logo

Boost Users :

From: Lars Gullik Bjønnes (larsbj_at_[hidden])
Date: 2004-12-23 06:02:11


Roland Schwarz <roland.schwarz_at_[hidden]> writes:

| 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 pair
| into your queue.
| Think of a semaphore only beeing a special case of
| (condvar,mutex,counter) triple.

Similar to this then I suppose?

I am sure it can be improved, but it has worked really well for me.



-- 
	Lgb


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