João Bernardo added the comment:
> It would be for waiting for several conditions associated with the
> same lock, not for waiting for several locks.
A Condition uses a 2 lock mechanism:
- outer lock: one for all the waiters to access the Condition object
- inner lock: one for each waiter to wait on.
You cannot associate several conditions to the *inner lock*, because you don't
have access to them (otherwise I wouldn't open this issue).
You said you want to have several conditions on the lock passed by the user:
lock = Lock()
cond1 = Condition(lock)
cond2 = Condition(lock)
Condition.wait_for_any({cond1: foo, cond2: bar})
but because this "lock" object is not the one the thread is waiting on, it
won't work.
> There is always a need for a predicate function.
You may not need to test for a predicate when using .wait() . Only when you're
using .wait_for()
This is what I'm most interested in mimicking.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18078>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com