Create a deferred value that is resolved when all listed deferred values
are resolved. Note that the error of an input deferred value
triggers the error when_all
as well.
when_all(..., .list = list())
A deferred value, that is conditioned on all deferred values
in ...
and .list
.
async has auto-cancellation, so if one deferred value errors, the rest of them will be automatically cancelled.
# \donttest{
## Check that the contents of two URLs are the same
afun <- async(function() {
u1 <- http_get("https://eu.httpbin.org")
u2 <- http_get("https://eu.httpbin.org/get")
when_all(u1, u2)$
then(function(x) identical(x[[1]]$content, x[[2]]$content))
})
synchronise(afun())
#> [1] FALSE
# }