thread.interrupt_main() behaviour

Piyush Verma 114piyush at
Tue Jul 1 10:58:57 CEST 2014


What is the behavior when we call thread.interrupt_main() method.

Using this method I have implemented a new method for checking timeout.

359    def TimeoutFunc(self):360       '''Function invoked by timer
thread in case of timeout '''361       self.log.debug("Timeout thread
invoked now for test %s" %       self.isTimeout =
True363       #Interrupt test process364       thread.interrupt_main()

Above method is invoked correctly, but I am not able to understand the
behaviour. Please have a look into below diagram to explain which I am

[image: Inline image 1]

Since two threads are running same method, I wanted to know which main
thread will be interrupted in both case.

Facebook <> Twitter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 23888 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list