Boost logo

Boost :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2006-09-19 18:12:29


On 9/19/06, Peter Dimov <pdimov_at_[hidden]> wrote:
> Anthony Williams wrote:
>
> > The read-write mutexes aren't ready, yet, but the old ones are broken
> > anyway.
>
> Feel free to use
>
> http://www.pdimov.com/cpp/rw_mutex.cpp
>
> until a better implementation turns up. :-)

Here's a lightweight starvation free (ticket based, no preference)
reader-writer lock.

It only works with vc++ right now, you'll have to change a
_InterlockedCompareExchange() and Sleep() for other platforms but that
should be easy.

Otherwise it follows the boost model already, but uses
scoped_read_lock and scoped_write_lock instead of just scoped_lock.

http://dev.int64.org/snips/rwlock.hpp

> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Cory Nelson
http://www.int64.org

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