Message190173
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() |
|
Date |
User |
Action |
Args |
2013-05-28 03:40:19 | JBernardo | set | recipients:
+ JBernardo |
2013-05-28 03:40:19 | JBernardo | set | messageid: <1369712419.12.0.434704480843.issue18078@psf.upfronthosting.co.za> |
2013-05-28 03:40:19 | JBernardo | link | issue18078 messages |
2013-05-28 03:40:18 | JBernardo | create | |
|