Author JBernardo
Recipients JBernardo, neologix, pitrou, sbt
Date 2013-05-28.15:52:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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.
Date User Action Args
2013-05-28 15:52:39JBernardosetrecipients: + JBernardo, pitrou, neologix, sbt
2013-05-28 15:52:38JBernardosetmessageid: <>
2013-05-28 15:52:38JBernardolinkissue18078 messages
2013-05-28 15:52:38JBernardocreate