Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73773

thread.interrupt_main() behaviour

Date 2014-07-01 14:28 +0530
Subject thread.interrupt_main() behaviour
From Piyush Verma <114piyush@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.11357.1404207056.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

thread.interrupt_main() behaviour Piyush Verma <114piyush@gmail.com> - 2014-07-01 14:28 +0530

csiph-web