powered by
This function uses parallel::mcparallel(), parallel::mcparallel(), so the time limit is not enforced on Windows. However, unlike functions using setTimeLimit(), the time limit is enforced even on native code.
parallel::mcparallel()
setTimeLimit()
forkTimeout( expr, timeout, unsupported = c("warning", "error", "message", "silent"), onTimeout = NULL )
Result of evaluating expr if completed, onTimeout
expr
onTimeout
otherwise.
expression to be evaluated.
number of seconds to wait for the expression to evaluate.
a character vector of length 1 specifying how to handle a platform that does not support parallel::mcparallel(), parallel::mcparallel(),
"warning"
"message"
Issue a warning or a message, respectively, then evaluate the expression without the time limit enforced.
"error"
Stop with an error.
"silent"
Evaluate the expression without the time limit enforced, without any notice.
Value to be returned on time-out.
forkTimeout({Sys.sleep(1); TRUE}, 2) # TRUE forkTimeout({Sys.sleep(1); TRUE}, 0.5) # NULL (except on Windows)
Run the code above in your browser using DataLab