lud / mutex

A simple deadlock-free multilock mutex for Elixir
MIT License
32 stars 8 forks source link

Fix type spec for under, under_all functions #1

Closed thousandsofthem closed 6 years ago

thousandsofthem commented 6 years ago

Atm Dialyzer going crazy on this one, expecting :ok but getting all sorts of stuff

niahoo commented 6 years ago

Hey, thank you, I will look into this !

niahoo commented 6 years ago

Merged. I also found a bad typespec for functions await/await_all. May I ask you what is your use of my lib ?

Thank you !

thousandsofthem commented 6 years ago

Probably something typical - under is guarding piece of code that calls external api which requires strictly incrementing param (think HMAC). like this:

def api_call(params) do
  Mutex.under(AppMutex, @name, fn ->
    HTTPoison.stuff(params)
  end)
end