Message171708
I think Sebastian's algorithm does not correctly deal with the non-blocking case. Consider the following situation:
* Thread-1 successfully acquires exclusive lock.
Now num_got_lock == 1.
* Thread-2 blocks waiting for shared lock.
Will block until (num_got_lock == 1 and excl_count == 0).
Now num_got_lock == 1.
* Thread-3 does non-blocking acquire of shared lock but fails.
Now num_got_lock == 2.
Now, since num_got_lock == 2, the predicate that Thread-2 is waiting for will not happen until num_got_lock overflows.
This is probably fixable if we just prevent a failed non-blocking acquire from modifying num_acq_lock and num_got_lock. (But I don't see how to extend the algorithm to allow timeouts.) |
|
Date |
User |
Action |
Args |
2012-10-01 12:16:35 | sbt | set | recipients:
+ sbt, pitrou, kristjan.jonsson, jyasskin, asvetlov, mklauber, Sebastian.Noack |
2012-10-01 12:16:35 | sbt | set | messageid: <1349093795.94.0.845842594576.issue8800@psf.upfronthosting.co.za> |
2012-10-01 12:16:35 | sbt | link | issue8800 messages |
2012-10-01 12:16:35 | sbt | create | |
|