
23 Dec
2004
23 Dec
'04
11:02 a.m.
Roland Schwarz <roland.schwarz@chello.at> 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