Hello,guys!!
I am using python2.7 to write a simple thread program which print the current 
running thread id
and kill it with this id.
But I have some questions with this.
My code: -----------------------------------------------------from threading 
import Threadclass t(Thread):     def __init__(self):          
Thread.__init__(self)     def run(self):          self.tid = Thread.get_ident() 
         print 'thread id is', self.tid     def kill(self):           *** // 
how to do this with its own id, for example "exit(self.tid)" ?if __name__ == 
"__main__"     go = t()     go.start()     
go.kill()-----------------------------------------------------First, I can't 
call get_ident(), seems not supported.
Second, how to kill the thread with its own id?
I know I can use SystemExit() to shut this down, but I want to kill the certain
thread not the whole program. Anyone know how to fix my code to achieve it?
Any tips welcomed.
Thank you in advance.
Kay                                       
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to