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


Groups > comp.lang.python > #68794

Re: terminate a program gracefully from a thread

From Terry Reedy <tjreedy@udel.edu>
Subject Re: terminate a program gracefully from a thread
Date 2014-03-22 16:48 -0400
References <CAOuJsMny-DV2kLS2EU1=FtHr6zkMH__-Q-2z8_-wnaSKmap8iA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8408.1395521304.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 3/22/2014 8:40 AM, Jabba Laci wrote:

> I have a script (see below) that I want to terminate after X seconds.
> The main loop of the program is waiting for user input.
> The program enters the main loop and I try to shut down the program
> after X seconds from a thread but I can't figure out how to do it. The
> program should also do some cleanup before termination, so the shut
> down must be graceful.

Although you have gotten comments specific to your problem, this type of 
thing should be easy (in just one thread) with asyncio (new in 3.4, 
backport on PyPI).

-- 
Terry Jan Reedy

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


Thread

Re: terminate a program gracefully from a thread Terry Reedy <tjreedy@udel.edu> - 2014-03-22 16:48 -0400

csiph-web