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


Groups > comp.lang.python > #73773

thread.interrupt_main() behaviour

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!Xbb.tags.giganews.com!border3.nntp.ams.giganews.com!nntp.giganews.com!news.osn.de!diablo2.news.osn.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <114piyush@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.218
X-Spam-Level **
X-Spam-Evidence '*H*': 0.61; '*S*': 0.04; 'method.': 0.07; '%s"': 0.09; 'method,': 0.09; 'def': 0.12; 'thread': 0.14; "'''": 0.16; 'behaviour.': 0.16; 'timeout': 0.16; 'case.': 0.24; 'message- id:@mail.gmail.com': 0.30; 'running': 0.33; 'checking': 0.33; 'implemented': 0.33; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'hi,': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'new': 0.61; 'facebook': 0.61; '[image:': 0.65; 'virus:src="cid:': 0.66; 'url:facebook': 0.67; 'content-type:multipart/related': 0.67; 'skip:r 30': 0.69; 'image-size:2**15': 0.72; 'inline': 0.74; 'behavior': 0.77; '360': 0.84; '359': 0.91; 'interrupted': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ntV9YhFFCfYBjAg97TVhkmEvR+MyPZ3A4qopMs0kgVs=; b=UyoWYClwLw0vg+Mvxx6tgCVLgQddLSz4FZLh+beNxEuJXQ9dKvRVLy9MAYApHd131Z ol1ehTc7v0duJY3E756r4O1YL6gZ+rUFqY20kKX7vUphevKz7eE28d7bagLIwEVB8e0Z UlXhk3FWLFXDyGPkOPYHzq0ZUPxG3umdmoERSQHw0LfT1Wj4fpbmiQaVl9zPoU+z72jX ABNjm2G2UpcgzLY2jXqhKwRzgDgd+gmUPuMR2CwBtuqsIiBzuWGeSGMufCw+ijNoW9y2 PCCIlnMBSVdkqt3+uzeI7q4UU63bgYZH8TV84l0bYQd2E6i1DatKfA6+yx3paCN9A8Pw fwig==
MIME-Version 1.0
X-Received by 10.152.9.234 with SMTP id d10mr1172054lab.56.1404205137296; Tue, 01 Jul 2014 01:58:57 -0700 (PDT)
Date Tue, 1 Jul 2014 14:28:57 +0530
Subject thread.interrupt_main() behaviour
From Piyush Verma <114piyush@gmail.com>
To python-list@python.org
Content-Type multipart/related; boundary=001a1132edec66fb6d04fd1dfc1c
X-Mailman-Approved-At Tue, 01 Jul 2014 11:30:55 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11357.1404207056.18130.python-list@python.org> (permalink)
Lines 504
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404207056 news.xs4all.nl 2949 [2001:888:2000:d::a6]:50928
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73773

Show key headers only | 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