472,142 Members | 1,315 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Re: Create a process with a "time to live"

On Fri, 2008-08-15 at 10:00 -0700, Carl J. Van Arsdall wrote:
Hey python[],

I want to create a process that would "expire" if it didn't complete in
a set amount of time. I don't seem to see any timeout values to pass
os.system - does anyone know of a good way to do this?

So far all I can think of is some kind of watchdog thread - but that
seems like overkill to do such a simple thing.
-Carl
Well, if you're on unix, the signal module is probably the easiest
method:

Python 2.5.2 (r252:60911, Jul 31 2008, 15:38:58)
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import signal
signal.alarm( 1 )
0
>>Alarm clock
(Interpreter exits)

--
John Krukoff <jk******@ltgc.com>
Land Title Guarantee Company

Aug 15 '08 #1
0 733

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Howard Jess | last post: by
reply views Thread by Carl J. Van Arsdall | last post: by
reply views Thread by Fredrik Lundh | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.