Stops a mirai if still in progress, causing it to resolve immediately to an 'errorValue' 20 (Operation canceled).

stop_mirai(aio)

Arguments

aio

a 'mirai' object.

Value

Invisible NULL.

Details

Forces the mirai to resolve immediately. Has no effect if the mirai has already resolved.

If cancellation was successful, the value at $data will be an 'errorValue' 20 (Operation canceled). Note that in such a case, the mirai is aborted and the value not retrieved - but any ongoing evaluation in the daemon process will continue and is not interrupted.

Examples

if (interactive()) {
# Only run examples in interactive R sessions

m <- mirai(Sys.sleep(n), n = 5)
stop_mirai(m)
m$data

}