Skip to content

Instantly share code, notes, and snippets.

@apboobalan
Last active December 22, 2020 06:56
Show Gist options
  • Save apboobalan/3e196d4e921ba3fd334b25e7373bfdc1 to your computer and use it in GitHub Desktop.
Save apboobalan/3e196d4e921ba3fd334b25e7373bfdc1 to your computer and use it in GitHub Desktop.
defmodule TaskiFirst.Taski do
def async(fun) do
spawning_process = self()
spawn(fn -> spawning_process |> send(fun.()) end)
end
def await() do
receive do
result -> result
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment