On Tue, Aug 19, 2014 at 1:44 PM, Marcos Caceres <w...@marcosc.com> wrote: > On August 19, 2014 at 4:39:03 PM, Tab Atkins Jr. (jackalm...@gmail.com) wrote: >> > Why is isHeld still used here? You don't need it to avoid squashing >> someone else's lock with this design, and several people have >> pointed out that exposing it is a footgun, as people might check it and >> decide they don't need to request their own lock (only to be screwed when >> the other lock releases earlier or later than they expected). > > It's the only authoritative source of truth. But ok, fair point about the > footgun. > > Consider the static dropped.
I mean, you could put a non-static isHeld on any individual lock, if you want to know whether this particular lock is held or released. I just don't think there's any reason to pass information around about the global lock state, if you're not being required to use that information for coordination purposes. ~TJ