question about threads

Aahz Maruch aahz at
Fri Jun 15 13:13:05 EDT 2001

In article <9gdc68$fhs$1 at>,
Alan Tsang  <atsang at> wrote:
>Is it possible to explicitly tell a thread to pass execution to another 
>thread in Python?  Any help is much appreciated.

Depends what you mean.  If you simple want the current thread to give up
the Global Interpreter Lock, use time.sleep() with a non-zero parameter;
however, the current thread may well be the one to reacquire the GIL.
If you want a specific other thread to pick up execution, you'll need to
use some lock-based mechanism; I generally recommend queues.
                      --- Aahz  <*>  (Copyright 2001 by aahz at

Hugs and backrubs -- I break Rule 6       
Androgynous poly kinky vanilla queer het Pythonista   

I wasn't licking it, I was chewing it.

More information about the Python-list mailing list