Threading and Conditions
Gordon McMillan
gmcm at hypernet.com
Wed Mar 22 08:30:45 EST 2000
Ken Seehof wrote:
> I apparently don't understand how conditions work.
>
> Both notify() and wait() require a thread lock. By my understanding,
> this
> means that a notify cannot occur while a wait is in progress (i.e. until
> we are
> done waiting for the notify), which means I'll be waiting a very long
> time :-).
> What's my confusion?
The lock isn't held during a wait. The Condition remembers
that this guy wants it.
> Unfortunately, the documentation is inadequate. Does anyone know of a
> whole sample program using conditions?
The test code at the bottom of the module.
> Is the Threading module the right thing to use for multi-threading?
Yes.
- Gordon
More information about the Python-list
mailing list