Task

Task provides a way to run jobs in the background and get its result later. Similar to Future or Promise in other languages.

task = Task.async(fn -> 
  :timer.sleep(1000)
  :ok
end)

result = Task.await(task)
IO.puts("Task result: #{result}")