I thought I had it figured out.... but not so.

GOAL: To create a program "timeread" with syntax:

timeread <secs> <prompt>

which returns the input value on stdout, or an exit value of 1 if 
timedout, or 2 if aborted by the user.

METHOD:

The current method I'm using is to spawn a process (background) 
which will sleep the appropriate amount of time, then kill the 
prompting process, which catches the signal and acts 
appropriately.

The flip side is that if input is taken, then the spawned sleeper 
process is killed and the program exits with data on stdout.

PROBLEM(S):

1. The original process can't kill the sleeper; sleep appears to 
ignore all signals until AFTER it is complete; GNU sleep does this 
too.

2. The original process can't exit until its children (i.e., the sleeper 
process) completes - it becomes (almost) a zombie.

SOLUTION:

Anyone know?

-- 
David Douthitt
UNIX Systems Administrator
HP-UX, Linux, Unixware
[EMAIL PROTECTED]

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to