locks icon indicating copy to clipboard operation
locks copied to clipboard

Incorrect spec

Open ddosia opened this issue 10 years ago • 1 comments

https://github.com/uwiger/locks/blob/master/src/locks.erl#L49 returns {<0.101.0>,{ok,[]}}, but according to spec second element should be lock_result() :: {lock_status(), deadlocks()} where lock_status() :: have_all_locks | have_none. I can change https://github.com/uwiger/locks/blob/master/src/locks_agent.erl#L312 so it will match one of these and send PR, but not sure what will be semantically correct, have_all_locks or have_none?

ddosia avatar Oct 24 '15 15:10 ddosia

Well, perhaps the correct return should be {no_locks, []}, since when await_all_locks() is called, the locks_agent calls all_locks_status(), which can result in no_locks. However, the notify() function doesn't currently translate that into a reply to await_all_locks(). I believe it should.

https://github.com/uwiger/locks/blob/master/src/locks_agent.erl#L956

uwiger avatar Oct 25 '15 11:10 uwiger