Closed howbazaar closed 8 years ago
Need to add a test for different named locks not interfering.
Looks pretty good to me, but I want to see the API surface reduced, specifically I want to see the error values unexported.
Key rationale to have an Acquirer interface is to be able to mock out the Mutex. To have something that wants a mutex.Acquirer, but doesn't actually want to interact with the system.
I have removed the two ways to do things, and stopped exporting errLocked.
I do still think it is valuable though to have ErrTimeout and ErrCancelled.exported.
Key rationale to have an Acquirer interface is to be able to mock out the Mutex. To have something that wants a mutex.Acquirer, but doesn't actually want to interact with the system.
What is the requirement to mock a mutex? If you want to have a dummy mutex then make up a random spec, heck write a testing helper, func UniqueSpec() Spec
, that does it for you.
Tested on linux, my mac book air, and on windows 10.