New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync: add Mutex.MustBeLocked #1366
Labels
Comments
It seems like a useful debugging tool, but I'm also a little horrified by the idea of code complex enough to need it. As you observed, the IsUnlocked described here isn't reliable - an AssertUnlocked that panics if the mutex is locked would be better. Labels changed: added packagechange. Owner changed to r...@golang.org. Status changed to Thinking. |
Comment 3 by cw@f00f.org: Why not an atomic LockIfUnlocked? That's useful sometimes to grab a lock when it's unlocked and fail otherwise. It's also race free. IsLocked for debugging can be done via other means. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: