Avoiding deadlocks in concurrent programming

Konstantin Veretennicov kveretennicov at gmail.com
Wed Jun 22 19:35:05 EDT 2005


On 6/23/05, Steve Horsley <steve.horsley at gmail.com> wrote:
> It is my understanding that Pythons multithreading is done at the
> interpteter level and that the interpreter itself is single
> threaded. In this case, you cannot have multiple threads running
> truly concurrently even on a multi-CPU machine

Python uses native threads.

>>> import thread, win32api
>>> win32api.GetCurrentThreadId()
1532
>>> def t():
...     print win32api.GetCurrentThreadId()
...
>>> for i in range(10):
...     thread.start_new_thread(t, ())
...
1212
1804
804
1276
1792
...

- kv



More information about the Python-list mailing list