Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

zhiqiangxu
Copy link
Contributor

@zhiqiangxu zhiqiangxu commented Jan 1, 2020

The passed in Locker will be Unlocked 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/470c7893cce57bd749d95f66cd116e8880eaa068/closer/strict.go#L69

@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Jan 1, 2020
@gopherbot
Copy link
Contributor

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from 志强 徐:

Patch Set 2:

Patch Set 2: Code-Review-2

New APIs need to be discussed on the issue tracker first, sorry.

OK, issue created.


Please don’t reply on this GitHub thread. Visit golang.org/cl/213018.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

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
@zhiqiangxu zhiqiangxu changed the title sync.WaitGroup: add WaitRelease(releaseFunc func()) sync.WaitGroup: add WaitUnlock(l Locker) Jan 2, 2020
@gopherbot
Copy link
Contributor

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/213018 has been abandoned.

The proposal got rejected today.

@gopherbot gopherbot closed this Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants