R/misc.utilities.R
forkTimeout.RdThis function uses
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.
forkTimeout(
expr,
timeout,
unsupported = c("warning", "error", "message", "silent"),
onTimeout = NULL
)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(),
"warning" or "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.
Partial matching is used.
Value to be returned on time-out.
Result of evaluating expr if completed, onTimeout
otherwise.
onTimeout can itself be an expression, so it is, for
example, possible to stop with an error by passing
onTimeout=stop().
Note that this function is not completely transparent: side-effects may behave in unexpected ways. In particular, RNG state will not be updated.