This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients jcea, neologix, pitrou, rhettinger, tim.peters
Date 2013-03-10.13:47:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362923247.97.0.789380152808.issue17385@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2013-03-10 13:47:28pitrousetrecipients: + pitrou, tim.peters, rhettinger, jcea, neologix
2013-03-10 13:47:27pitrousetmessageid: <1362923247.97.0.789380152808.issue17385@psf.upfronthosting.co.za>
2013-03-10 13:47:27pitroulinkissue17385 messages
2013-03-10 13:47:27pitroucreate