alarmc {fame} | R Documentation |
This is a simple wrapper around the POSIX alarm()
system call. Unfortunately, it is not available on Windows.
alarmc(seconds = 0)
seconds |
integer number of seconds to wait before sending
SIGALRM to the R process, or 0 (zero) to cancel any existing timer. |
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.
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.
Jeff Hallman
See the man page for alarm
## 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)