time and thread modules.

sismex01 at hebmex.com sismex01 at hebmex.com
Fri Oct 11 09:21:07 EDT 2002


> From: hansgeunsmeyer at earthlink.net 
> 
> sismex01 at hebmex.com wrote in message 
> news:<mailman.1034265014.21912.python-list at python.org>...
> 
> > [..snip..question about sleep() and GIL...]
> 
> If you look at the implementation of time.sleep in timemodule.c,
> you'll see that before actually calling Sleep (or select, or whatever
> the function is, depending on your platform), Python uses the
> Py_BEGIN_ALLOW_THREADS macro which
> saves the current thread state, and releases the GIL (MacIntosh code
> is a bit different here, but I suppose the effect is the same).  Once
> the GIL is released some other thread may grap it.
> 
> Hans

Thanks Hans, that's exactly what I needed to know. :-)

-gustavo




More information about the Python-list mailing list