thread.interrupt_main() behaviour

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


Hi,

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.name)362       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
using.

[image: Inline image 1]


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

Regards,
~Piyush
Facebook <https://www.facebook.com/piyushkv1> Twitter
<https://twitter.com/SocializePiyush>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140701/2e9c4f9a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 23888 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140701/2e9c4f9a/attachment.png>


More information about the Python-list mailing list