use rt ; $pid = rtbkg($cmd[, stdout[, stderr]]) ; @msgs = rtkill(time2die, @pids) @children = rtchildren($pid) $aborted = rtrun($cmd, $timeout[, stdout[, stderr]]) ($result, $output) = rtcmdout($cmd, $timeout) rtalarm($pid, $timeout, \$aborted) mbkg(\%Background_tasks, $cmd) ; @log = mwait(\%Background_tasks[, keep]) ; $compressed = rtcompress($filename) ;
rtkill kills all the processes specified by @pids, including their children. If time2die seconds expires without a process dying, rtkill atttempts to kill it with a -9 signal. It returns a set of messages about what pids were terminated.
rtchildren returns the pids of all the children of a process.
rtrun runs $cmd, but if $timeout seconds expires before $cmd completes, it kills the process and all its children. The returned flag is one if the process time exceeded the timeout and the process was killed.
rtalarm sets up an alarm for $timeout seconds; if the timer expires before alarm 0 is run, the process $pid and all its children are killed. A message is printed on stderr and stdout, and the $aborted flag variable is set to one. The caller must execute alarm 0 following the questionable activity, so that the timer doesn't expire while something else is happening.
rtbkg runs a command in the background.
rtcmdout runs the specified command (with an optional timeout) and returns the result and the combined output from stdout and stderr.
mbkg runs multiple commands at once in the background, limited to `getid concurrent`. When the limit is reached, then jobs are put on a queue. Jobs are only put into execution when mbkg is called, or by mwait. mwait is called to wait for all queued and running jobs to finish; it returns the complete logs in a list. (These logs have been saved as individual files in a temporary directory in $Background{LOGS}
rtcompress runs some compress program (bzip2) on the input filename and returns the compressed filename.
$pid = open ( IN, "questionable |" ) ; rtalarm ( $pid, 300, \$aborted ) ; while ( <IN> ) { work() ; } alarm 0 ; if ( $aborted ) { print STDERR "questionable failed\n" ; }