Skip to content

Instantly share code, notes, and snippets.

@nsomar
Created May 17, 2017 13:25
Show Gist options
  • Save nsomar/1d6bc4a1ef67972822e0584b7843e412 to your computer and use it in GitHub Desktop.
Save nsomar/1d6bc4a1ef67972822e0584b7843e412 to your computer and use it in GitHub Desktop.
defmodule Utilities do
def write(content, file) do
# get th target process
target = self()
spawn(fn ->
# write stuff to disk
# takes long time
# send a message to it
send(target, result_of_write)
end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment