Skip to content

Instantly share code, notes, and snippets.

@nsomar
Created May 17, 2017 13:28
Show Gist options
  • Save nsomar/65163eea61eda0ec49d5a3dd44a180db to your computer and use it in GitHub Desktop.
Save nsomar/65163eea61eda0ec49d5a3dd44a180db to your computer and use it in GitHub Desktop.
def async(mod, fun, args) do
mfa = {mod, fun, args}
owner = self()
pid = Task.Supervised.spawn_link(owner, get_info(owner), mfa)
ref = Process.monitor(pid)
send(pid, {owner, ref})
%Task{pid: pid, ref: ref, owner: owner}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment