How to perform an asynchronous call in Erlang

Also known as a promise, a future, a deferred or a task.

Emad El-Haraty
1 min readMar 7, 2014

If you’ve convinced yourself you need to perform an async call in Erlang, you can use some of the functions in the rpc module.

The most immediately useful function in that module that helps is async_call:

async_call(Node, Module, Function, Args) -> Key

You can then call yield on the key to obtain the data:

yield(Key) -> Res | {badrpc, Reason}.

--

--