Skip to content

Instantly share code, notes, and snippets.

@vishnevskiy
Created July 6, 2017 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishnevskiy/ddfb274ed64c58bfa7387147b03320f1 to your computer and use it in GitHub Desktop.
Save vishnevskiy/ddfb274ed64c58bfa7387147b03320f1 to your computer and use it in GitHub Desktop.
semaphore_name = :my_sempahore
semaphore_max = 10
case Semaphore.call(semaphore_name, semaphore_max, fn -> :ok end) do
:ok ->
IO.puts "success"
{:error, :max} ->
IO.puts "too many callers"
end
@keli5
Copy link

keli5 commented Jun 20, 2020

my_sempahore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment