Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Extend shared_mutex with support for priority policies?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-12-17 15:38:00

Le 15/12/12 19:16, Fredrik Orderud a écrit :
> The current "fair" shared_mutex implementation is great in the sense
> that it neither favors readers nor writers. This is probably a good
> property in most situations.
> However, there are situations where either reader or writer
> prioritization can be beneficial. In particular, I'm working on a
> project where the locking could be significantly stricter without
> risking introducing deadlocks if read-locks could be guaranteed to
> have priority over write-locks. I fully understand that a read- or
> write-priority implementation might have a bigger overhead compared to
> the existing "fair" shared_mutex implementation, but that is unlikely
> to be a problem for me.
> Is anyone in the boost community experiencing similar problems and/or
> is there any interest in extending shared_mutex with support for
> different priority policies?
I think that it will be better to create specific shared mutex classes
with read/write/fifo priorities. The interface of these classes must
mimic boost::shared_mutex so that we are able to use them with the
shared_lock and upgrade_lock.

I have no time to work on this now but if you provide a first
implementation I could help you to finish it so that it can be
introduced in Boost.Thread.


Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at