Question about Python threads
aahz at pythoncraft.com
Thu Aug 22 05:28:09 CEST 2002
In article <pan.2002.08.21.14.18.37.335853.19857 at charter.net>,
Mr. Neutron <nicktsocanos at charter.net> wrote:
> If I understand, only one thread can be in the interpreter at any time.
>Now what I don't understand is being in the interpreter at a time part.
That means pure Python code. For example:
x = 1 + 2
However, if you call a C function that releases the global interpreter
lock (GIL), then multiple threads can run concurrently. Most I/O
functions in Python do this. For example:
page = urllib.urlopen('http://www.python.org/').read()
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
More information about the Python-list