Boost logo

Boost :

From: Glen Knowles (gknowles_at_[hidden])
Date: 2004-07-10 16:31:48


> From: Matt Hurd [mailto:matt.hurd_at_[hidden]]
>
> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk