task = Task.async(fn -> expensive_computation end)
do_something_else
result = Task.await(task)
crawled_site = ["http://www.google.com", "http://www.stackoverflow.com"]
|> Enum.map(fn site -> Task.async(fn -> crawl(site) end) end)
|> Enum.map(&Task.await/1)
| Parameter | Details |
|---|---|
| fun | The function that should be executed in a separate process. |
| task | The task returned by Task.async. |