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 <rep...@bugs.python.org> <http://bugs.python.org/issue18078> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com