[New-bugs-announce] [issue18078] threading.Condition to allow notify on a specific waiter
João Bernardo
report at bugs.python.org
Tue May 28 05:40:19 CEST 2013
New submission from João Bernardo:
If users could provide an inner lock for `threading.Condition` acquire when making a thread wait, it would allow for notifying a specific waiter.
Because of race conditions, using:
cond.notify(1)
may not wake the thread I want. Also, I may not want to wake the first waiter at all.
So my proposal is something along the lines:
class Condition:
...
def wait(self, timeout=None, lock=None):
...
waiter = _allocate_lock() if lock is None else lock
...
def notify_one(self, lock):
# Maybe could notify a list of locks?
try:
self._waiters.remove(lock)
except ValueError:
pass
# Maybe RuntimeError("Lock not waiting in this Condition")
else:
lock.release()
----------
components: Library (Lib)
messages: 190173
nosy: JBernardo
priority: normal
severity: normal
status: open
title: threading.Condition to allow notify on a specific waiter
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18078>
_______________________________________
More information about the New-bugs-announce
mailing list