C++, Python & Threads
Martin v. Loewis
martin at v.loewis.de
Sun Mar 3 15:53:12 EST 2002
"VUG" <plugin at airtel.net> writes:
> When I launch python console and I create a thread I get a NUMBER but......
> This number doesn't the same as the one I get by the function
> thread.get_ident(). What's wrong in the code?
PyThread_get_thread_ident, having no parameters, always returns the
thread id of the calling thread. If you want the thread id of the new
thread, you need to invoke PyThread_get_thread_ident inside of the new
thread.
BTW, in Python 2.2, start_new_thread does return the thread id of the
new thread.
HTH,
Martin
More information about the Python-list
mailing list