question about threads
Aahz Maruch
aahz at panix.com
Fri Jun 15 13:13:05 EDT 2001
In article <9gdc68$fhs$1 at news.hk.linkage.net>,
Alan Tsang <atsang at hk.linkage.net> 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 pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
I wasn't licking it, I was chewing it.
More information about the Python-list
mailing list