Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: cross platform alternative for signal.SIGALRM? Date: Thu, 12 Nov 2015 08:14:48 +0200 Organization: A noiseless patient Spider Lines: 21 Message-ID: <877flnu4kn.fsf@elektro.pacujo.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="6457"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PKSjOlD7mWvHhY+8jMYrp" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ixOpG4qrZ3gAOFG7Ta17xxquTyk= sha1:7z9BB9qtJFVvB7qyqbyMOs+Gnf8= Xref: csiph.com comp.lang.python:98673 Terry Reedy : > The cross-platform 3.4 asyncio module has some functions with > timeouts. Even that doesn't forcefully interrupt an obnoxious blocking function call like time.sleep(10000) The original question claimed signal.alarm() would do the trick in Linux. However, even that cannot be relied on as "man alarm" states: sleep(3) may be implemented using SIGALRM; mixing calls to alarm() and sleep(3) is a bad idea. I'm thinking the only portable way is to run a watchdog process with subprocess or multiprocessing. Marko