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
Mutex#unlock with block #10663
base: master
Are you sure you want to change the base?
Mutex#unlock with block #10663
Conversation
Hi! Can you provide a use case for this? |
For the same reason as Spinlock#unsync? It's hard to unlock small section of code when using blocks, loops, or user provided blocks especially when they may throw an exception leaving a data structure unprotected.
|
Sounds good to me. I'm not sure about the name, though. Can we find a better one? Its behaviour is different from the existing |
Just noting that this doesn't exist in Ruby, so I do wonder whether this is needed or that common. You can always do: m.unlock
begin
# ...
ensure
m.lock
end right? |
Could use
On the same topic renaming |
That's the code I used at first. When I needed it a 2nd time in the same class I made a method. There's an identical (now unused) method in Ultimately this issue isn't important. If you think the use is too rare for inclusion please close the PR. No hard feelings. |
No description provided.