Skip to content

WaitTimeoutResult Example does not exhibit timeout #48230

Closed
@stevedonovan

Description

@stevedonovan

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.

Activity

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on Feb 15, 2018
added 2 commits that reference this issue on Feb 16, 2018

Rollup merge of rust-lang#48239 - GuillaumeGomez:fix-condvar-example,…

daed6d3

Rollup merge of rust-lang#48239 - GuillaumeGomez:fix-condvar-example,…

3672caf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @stevedonovan@gsollazzo

        Issue actions

          WaitTimeoutResult Example does not exhibit timeout · Issue #48230 · rust-lang/rust