alarmc {fame}R Documentation

Interface to alarm() system call

Description

This is a simple wrapper around the POSIX alarm() system call. Unfortunately, it is not available on Windows.

Usage

alarmc(seconds = 0)

Arguments

seconds integer number of seconds to wait before sending SIGALRM to the R process, or 0 (zero) to cancel any existing timer.

Details

alarmc(seconds) sets a timer running for seconds seconds and returns immediately. The default value 0 unsets the timer, if there is one.

When the time is up, the SIGALRM signal is sent to the R process. Since R does not define a handler for this signal, the default handler is invoked, which terminates the R process.

Note

Microsoft, in it's infinite wisdom, does not provide the alarm() system call in its C libraries. Instead, they expect you to use the SetTimer function to do this kind of stuff, but SetTimer is not available to a console-mode application. I do wonder how they get away with claiming POSIX compatibility.

Author(s)

Jeff Hallman

References

See the man page for alarm

See Also

Sys.sleep

Examples

## Not run: 
## wait up to 10 minutes for a socket connection or die
alarmc(600) 
conn <- socketConnection(port = 40001, server = T, blocking = T)
alarmc(0)  ## turn off the timer
incomingText <- readLines(conn)
close(conn)
## End(Not run)

[Package fame version 1.09 Index]