time and thread modules.

sismex01 at hebmex.com sismex01 at hebmex.com
Thu Oct 10 11:46:16 EDT 2002


> From: Michael Gilfix [mailto:mgilfix at eecs.tufts.edu]
> 
>   Yes. When a thread blocks, it yields control and allows python (or
> rather the underlying OS) to give time to other threads). Not sure if
> it's relevant, but you can also use the yeild () function if you want
> to relinquish control as well.
> 
>                          -- Mike
>

Hmmm... there's a "yield" in python to relinquish thread control
which isn't the "yield" we all know and love used for generators?

My question comes from the fact that there's Python's GIL; so,
if I sleep() a task, which internally calls the OS's sleep()
syscall, which then yields control to another thread... What happens
in the Python side of the equation?

Is another of Python's thread's scheduled?

Does the same thread keep the GIL, which in fact precludes
any other of python's threads from running until sleep()
returns?

Does sleep() help out in a python multithreading app?

-gustavo





More information about the Python-list mailing list