RE: [boost] Re: Boost.Threads: Do we need all those mutexes?

From: Matt Hurd [mailto:matt.hurd@gmail.com]
Holding multiple locks is pretty common and necessary. If you can guarantee they will always be acquired in the same order they will not deadlock.
It is necessary. :)
AFAIK r/w locks only makes sense if you're going to hold read locks for a period of time, otherwise you're better off just using a regular mutex.
Concurrency may be better with shared access.
The most common case for me is for collections. Multi-read might be quite important to your application's concurrent performance.
My logic is that using a read lock only improves concurrency over exclusion for that period of time that you hold the lock. If that period is short any improvement will likely be insignificant next to what you paid for hitting the memory barrier in either case. Of course, YMMV :) Glen
participants (1)
-
Glen Knowles