-
Notifications
You must be signed in to change notification settings - Fork 18k
sync.WaitGroup: add WaitUnlock(l Locker) #36348
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
Conversation
This PR (HEAD: 215e32f) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/213018 to see it. Tip: You can toggle comments from me using the |
215e32f
to
62e56b8
Compare
This PR (HEAD: 62e56b8) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/213018 to see it. Tip: You can toggle comments from me using the |
Message from Daniel Martí: Patch Set 2: Code-Review-2 New APIs need to be discussed on the issue tracker first, sorry. Please don’t reply on this GitHub thread. Visit golang.org/cl/213018. |
Message from 志强 徐: Patch Set 2:
OK, issue created. Please don’t reply on this GitHub thread. Visit golang.org/cl/213018. |
Message from Ian Lance Taylor: Patch Set 4: Please add Fixed #36349 to the commit message so that this change is linked to the issue. Thanks. Please don’t reply on this GitHub thread. Visit golang.org/cl/213018. |
62e56b8
to
109370e
Compare
This PR (HEAD: 109370e) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/213018 to see it. Tip: You can toggle comments from me using the |
The passed in `Locker` will be called immediately if no need to wait, or right before wait(`runtime_Semacquire`). This can be useful when some resources can be released before wait, e.g, when `Add/Wait` are synchronised by RWMutex, where `Add` only happens while holding `RLock` and `Wait` only happens while holding `Lock`. Here's a concrete example: https://github.com/zhiqiangxu/util/blob/master/closer/state.go#L58 Fixed golang#36349
109370e
to
9e84fc6
Compare
This PR (HEAD: 9e84fc6) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/213018 to see it. Tip: You can toggle comments from me using the |
This PR is being closed because golang.org/cl/213018 has been abandoned. The proposal got rejected today. |
The passed in
Locker
will beUnlock
ed immediately if no need to wait, or right before wait(runtime_Semacquire
).This can be useful when some resources can be released before wait, e.g, when
Add/Wait
are synchronised byRWMutex
,where
Add
only happens while holdingRLock
andWait
only happens while holdingLock
.Here's a concrete example:
https://github.com/zhiqiangxu/util/blob/470c7893cce57bd749d95f66cd116e8880eaa068/closer/strict.go#L69