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: fix Notify to clone the waker before locking its waiter list #4129

Merged
merged 1 commit into from Sep 23, 2021

Commits on Sep 22, 2021

  1. sync: fix Notify to clone the waker before locking its waiter list

    Since a waker can trigger arbitrary code, such as with a custom waker,
    and even more so now that it can emit a tracing event that could do
    respond, we must be careful about the internal state when that code is
    triggered. The clone method of a waker is one of those instances.
    
    This changes the internals of `Notify` so that the waker is cloned
    *before* locking the waiter list. While this does mean that in some
    contended cases, we'll have made an optimistic clone, it makes `Notify`
    more robust and correct.
    
    Note that the included test case is built from an instance that did
    happen naturally in another project, see
    tokio-rs/console#133.
    seanmonstar committed Sep 22, 2021
    Copy the full SHA
    d91a448 View commit details
    Browse the repository at this point in the history