Skip to content
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

sync: Cond WaitFor and/or WaitUntil method(s) #24429

Closed
dfawley opened this issue Mar 16, 2018 · 1 comment
Closed

sync: Cond WaitFor and/or WaitUntil method(s) #24429

dfawley opened this issue Mar 16, 2018 · 1 comment

Comments

@dfawley
Copy link

dfawley commented Mar 16, 2018

I would like to block on a condition variable, but give up when a timeout/deadline is reached. I.e.:

func (c *Cond) WaitFor(d time.Duration) bool {}
func (c *Cond) WaitUntil(t time.Time) bool {}

This functionality can be implemented without a sync.Cond using channels and timers and a select, but I believe a sync.Cond would be more efficient and succinct.

FYI: #21165

@ianlancetaylor
Copy link
Contributor

Dup of #23211, which was closed.

@golang golang locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants