syncutil: add AssertRHeld methods to RWMutex implementations#39609
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Aug 13, 2019
Merged
syncutil: add AssertRHeld methods to RWMutex implementations#39609craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
ajwerner
approved these changes
Aug 12, 2019
Contributor
ajwerner
left a comment
There was a problem hiding this comment.
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
nvb
commented
Aug 13, 2019
Contributor
Author
nvb
left a comment
There was a problem hiding this comment.
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
requirethis could be:require.PanicsWithValue(t, "mutex is not read locked", m.AssertRHeld)
Nice! Done.
Contributor
Build failed (retrying...) |
Contributor
Author
|
bors r- |
Contributor
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
Contributor
Author
|
bors r+ |
craig bot
pushed a commit
that referenced
this pull request
Aug 13, 2019
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>
Contributor
Build succeeded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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