I have a program and I start 3 threads separately. I am using version 2.4.3.
thread.get_ident()
is not available in this version of Python I guess.
I use threading.currentThread()
but it only returns me this:
<_MainThread(MainThread, started)>
In other versions (3.3.3) I get something like
<_MainThread(MainThread, started 5420)>
where 5420
represents the Thread ID. How can I get this ID in Python 2.4 Versions?
答案 0 :(得分:0)
根据2.4.3 thread
docs,get_ident
是thread
上的方法:
get_ident()
返回&#39;线程标识符&#39;当前线程。这是一个非零整数。它的价值没有直接意义;它旨在作为一种神奇的饼干用于例如索引特定于线程的数据的字典。当线程退出并创建另一个线程时,线程标识符可以被回收。