Last active
December 22, 2020 06:56
-
-
Save apboobalan/3e196d4e921ba3fd334b25e7373bfdc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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