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

WaitTimeoutResult Example does not exhibit timeout #48230

Closed
stevedonovan opened this issue Feb 15, 2018 · 0 comments
Closed

WaitTimeoutResult Example does not exhibit timeout #48230

stevedonovan opened this issue Feb 15, 2018 · 0 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@stevedonovan
Copy link

This example does not exhibit the desired behaviour:

https://doc.rust-lang.org/beta/std/sync/struct.WaitTimeoutResult.html

In the thread, the mutex is locked before waiting and then setting the condition, so wait_timeout waits until the condition is set (try changing that 20 ms to 1000 ms for dramatic effect). The sleep should be before the lock and notify.

@gsollazzo gsollazzo added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Feb 15, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 16, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

2 participants