Skip to content

Commit 8e5283f

Browse files
committed
docs
1 parent 7330155 commit 8e5283f

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

R/mirai.R

+13-11
Original file line numberDiff line numberDiff line change
@@ -287,30 +287,32 @@ call_mirai_ <- call_aio_
287287
#'
288288
#' @return Invisible NULL.
289289
#'
290-
#' @details Forces the mirai to resolve immediately. If the asynchronous
291-
#' evaluation was not yet complete, attempting to access its value at
292-
#' \code{$data} will return a 'miraiInterrupt' (see
293-
#' \code{\link{is_mirai_interrupt}}).
290+
#' @details Forces the mirai to resolve immediately.
294291
#'
295-
#' Note that in this case, it is only guaranteed that the mirai value is not
296-
#' returned - any ongoing evaluation in the daemon process will continue and
297-
#' is not interrupted.
292+
#' If the asynchronous evaluation is yet to complete, the value at
293+
#' \code{$data} will resolve to a 'miraiInterrupt' (see
294+
#' \code{\link{is_mirai_interrupt}}). Note that in such a case, it is only
295+
#' guaranteed that the mirai is aborted and the value not retrieved - any
296+
#' ongoing evaluation in the daemon process will continue and is not
297+
#' interrupted.
298298
#'
299299
#' @examples
300300
#' if (interactive()) {
301301
#' # Only run examples in interactive R sessions
302302
#'
303303
#' s <- mirai(Sys.sleep(n), n = 5)
304304
#' stop_mirai(s)
305+
#' s$data
305306
#'
306307
#' }
307308
#'
308309
#' @export
309310
#'
310-
stop_mirai <- function(aio) if (unresolved(aio)) {
311-
assign("value", mk_interrupt_error(), envir = aio)
312-
stop_aio(aio)
313-
}
311+
stop_mirai <- function(aio)
312+
if (unresolved(aio)) {
313+
assign("value", mk_interrupt_error(), envir = aio)
314+
stop_aio(aio)
315+
}
314316

315317
#' Query if a mirai is Unresolved
316318
#'

man/stop_mirai.Rd

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests.R

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ if (connection) {
6262
args <- c(m = 2L, n = 4L)
6363
m <- mirai(.expr = `lang obj`, .args = args, .timeout = 2000L)
6464
nanotest(is_error_value(call_mirai_(m)$data) || m$data == 8L)
65+
nanotestn(stop_mirai(m))
6566
Sys.sleep(2.5)
6667
}
6768
# daemons tests

0 commit comments

Comments
 (0)