Message183875
Actually, wait() calls self._waiters.remove() without holding the lock. But I think it could easily do so after taking the lock (since it takes it anyway before returning).
Also, _waiters should better be a set, since wait() needs the associative behaviour when unregistering a waiter.
notify() would then look like:
for i in range(n):
try:
waiter = self._waiters.pop()
except KeyError:
break
waiter.release()
and wait() would look like:
waiter = _allocate_lock()
waiter.acquire()
self._waiters.add(waiter)
self._release_save()
try:
return waiter.acquire(timeout)
finally:
self._acquire_restore()
self._waiters.discard(waiter) |
|
Date |
User |
Action |
Args |
2013-03-10 13:47:28 | pitrou | set | recipients:
+ pitrou, tim.peters, rhettinger, jcea, neologix |
2013-03-10 13:47:27 | pitrou | set | messageid: <1362923247.97.0.789380152808.issue17385@psf.upfronthosting.co.za> |
2013-03-10 13:47:27 | pitrou | link | issue17385 messages |
2013-03-10 13:47:27 | pitrou | create | |
|