Debian Codegraph @

man/run_now.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/later.R
3 \name{run_now}
4 \alias{run_now}
5 \title{Execute scheduled operations}
6 \usage{
7 run_now(timeoutSecs = 0L, all = TRUE, loop = current_loop())
8 }
9 \arguments{
10 \item{timeoutSecs}{Wait (block) for up to this number of seconds waiting for
11 an operation to be ready to run. If \code{0}, then return immediately if there
12 are no operations that are ready to run. If \code{Inf} or negative, then wait as
13 long as it takes (if none are scheduled, then this will block forever).}
14
15 \item{all}{If \code{FALSE}, \code{run_now()} will execute at most one scheduled
16 operation (instead of all eligible operations). This can be useful in cases
17 where you want to interleave scheduled operations with your own logic.}
18
19 \item{loop}{A handle to an event loop. Defaults to the currently-active loop.}
20 }
21 \value{
22 A logical indicating whether any callbacks were actually run.
23 }
24 \description{
25 Normally, operations scheduled with \code{\link[=later]{later()}} will not execute unless/until
26 no other R code is on the stack (i.e. at the top-level). If you need to run
27 blocking R code for a long time and want to allow scheduled operations to run
28 at well-defined points of your own operation, you can call \code{run_now()} at
29 those points and any operations that are due to run will do so.
30 }
31 \details{
32 If one of the callbacks throws an error, the error will \emph{not} be caught, and
33 subsequent callbacks will not be executed (until \code{run_now()} is called again,
34 or control returns to the R prompt). You must use your own
35 \link[base:conditions]{tryCatch} if you want to handle errors.
36 }