async: Create an async function

View source: R/aaa-async.R

asyncR Documentation

Create an async function

Description

Create an async function, that returns a deferred value, from a regular function. If fun is already an async function, then it does nothing, just returns it.

Usage

async(fun)

Arguments

fun

Original function.

Details

The result function will have the same arguments, with the same default values, and the same environment as the original input function.

Value

Async version of the original function.

Examples

f <- function(x) 42
af <- async(f)
is_async(f)
is_async(af)
f()
synchronise(dx <- af())
dx

gaborcsardi/async documentation built on Nov. 20, 2024, 4:51 p.m.