简体   繁体   中英

python: Check status of thread by ID

I have a multithreading Python(2.7) program, which runs multiple threads for different tasks. I am storing the thread-ids, for tracking the status of threads in a separate thread for status-tracking.

How can I check the thread is alive or not ( isAlive() ) by having the thread-id ?

As far as I know, I don't believe there's a way to retrieve the thread by its thread_id. Your best bet would be to store a reference to the thread object itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM