-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
syncutil: add AssertRHeld methods to RWMutex implementations #39609
syncutil: add AssertRHeld methods to RWMutex implementations #39609
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)
pkg/util/syncutil/mutex_sync_race_test.go, line 70 at r1 (raw file):
m.Unlock() func() {
If you feel like adopting require
this could be:
require.PanicsWithValue(t, "mutex is not read locked", m.AssertRHeld)
a630d8a
to
9ba111c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r=ajwerner
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajwerner)
pkg/util/syncutil/mutex_sync_race_test.go, line 70 at r1 (raw file):
Previously, ajwerner wrote…
If you feel like adopting
require
this could be:require.PanicsWithValue(t, "mutex is not read locked", m.AssertRHeld)
Nice! Done.
Build failed (retrying...) |
bors r-
|
Canceled |
This mirrors the AssertHeld methods we have on these mutexes and extends them for read locks. These serve as both a useful assertion and good documentation (because they compile away for real builds). Release note: None
9ba111c
to
86241f9
Compare
bors r+ |
39609: syncutil: add AssertRHeld methods to RWMutex implementations r=nvanbenschoten a=nvanbenschoten This mirrors the AssertHeld methods we have on these mutexes and extends them for read locks. These serve as both a useful assertion and good documentation (because they compile away for real builds). #39119 reminded me that I had been sitting on this commit since June as part of a larger change that won't be making it in any time soon. Release note: None Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
Build succeeded |
This mirrors the AssertHeld methods we have on these mutexes and extends them for read locks. These serve as both a useful assertion and good documentation (because they compile away for real builds).
#39119 reminded me that I had been sitting on this commit since June as part of a larger change that won't be making it in any time soon.
Release note: None