Re: [patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-11 Thread Jonathan Wakely
On 08/04/15 20:11 +0100, Jonathan Wakely wrote: diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5871716..39d6866 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -2,7 +2,8 @@ * include/std/shared_mutex (shared_timed_mutex): Add comments to ex

Re: [patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-08 Thread Jonathan Wakely
On 08/04/15 20:11 +0100, Jonathan Wakely wrote: We can get rid of the _Mutex type then, and just use std::mutex, and that also means we can provide the timed locking functions even when !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK). And so maybe we should use this fallback implementation instead of the

Re: [patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-08 Thread Jonathan Wakely
On 08/04/15 18:59 +0200, Torvald Riegel wrote: +// set or the maximum number of reader locks is held, then increment the +// reader lock count. +// To release decrement the count, then if the write-entered flag is set +// and the count is zero then signal gate2 to wake a queued wr

Re: [patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-08 Thread Torvald Riegel
There is an correctness issue related to mutex destruction. The added documentation is a good start, but I'd still add some more for the complicated pieces of reasoning. Details inline below. On Tue, 2015-04-07 at 15:28 +0100, Jonathan Wakely wrote: > diff --git a/libstdc++-v3/include/std/shared

[patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-07 Thread Jonathan Wakely
When I implemented the C++14 type std::shared_timed_mutex (or std::shared_mutex as it was originally called) I must have been half asleep, because I completely messed up the timed locking functions, try_lock_for, try_lock_until, try_shared_lock_for and try_shared_lock_until. I wrote them to only u