Skip to content

Conversation

danielparks
Copy link
Contributor

This fixes a few race conditions in test_waker_threaded() and adds a timeout to ensure that it doesn’t hang forever if something goes wrong.

Some notes:

  • It is always possible to have messages on the channel after the thread has finished, since the thread could write a message and finish between the call to poll() and the start of the next loop.
  • reset() could swallow the last wake.
  • It is possible to get either timeouts or events from poll() after the thread finishes. I’m not sure how it gets more events, but when I only checked for is_finished() when getting a timeout, it sometimes hung forever.

Fixes: #19 — test_waker_threaded fails or hangs in Rust 1.70

This fixes a few race conditions in `test_waker_threaded()` and adds a
timeout to ensure that it doesn’t hang forever if something goes wrong.

Some notes:

  * It is always possible to have messages on the channel after the
    thread has finished, since the thread could write a message and
    finish between the call to `poll()` and the start of the next loop.
  * `reset()` could swallow the last wake.
  * It is possible to get either timeouts or events from `poll()` after
    the thread finishes. I’m not sure how it gets more events, but when
    I only checked for `is_finished()` when getting a timeout, it
    sometimes hung forever.

Fixes: cloudhead#19 — test_waker_threaded fails or hangs in Rust 1.70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_waker_threaded fails or hangs in Rust 1.70
1 participant