Skip to content

Commit

Permalink
sync: add warning for watch in non-Send futures (#4741)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Jun 28, 2022
1 parent b51aa8f commit 45f24f1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tokio/src/sync/watch.rs
Expand Up @@ -91,7 +91,9 @@ pub struct Sender<T> {
///
/// Outstanding borrows hold a read lock on the inner value. This means that
/// long lived borrows could cause the produce half to block. It is recommended
/// to keep the borrow as short lived as possible.
/// to keep the borrow as short lived as possible. Additionally, if you are
/// running in an environment that allows `!Send` futures, you must ensure that
/// the returned `Ref` type is never held alive across an `.await` point.
///
/// The priority policy of the lock is dependent on the underlying lock
/// implementation, and this type does not guarantee that any particular policy
Expand Down Expand Up @@ -301,7 +303,9 @@ impl<T> Receiver<T> {
///
/// Outstanding borrows hold a read lock. This means that long lived borrows
/// could cause the send half to block. It is recommended to keep the borrow
/// as short lived as possible.
/// as short lived as possible. Additionally, if you are running in an
/// environment that allows `!Send` futures, you must ensure that the
/// returned `Ref` type is never held alive across an `.await` point.
///
/// The priority policy of the lock is dependent on the underlying lock
/// implementation, and this type does not guarantee that any particular policy
Expand Down Expand Up @@ -344,7 +348,9 @@ impl<T> Receiver<T> {
///
/// Outstanding borrows hold a read lock. This means that long lived borrows
/// could cause the send half to block. It is recommended to keep the borrow
/// as short lived as possible.
/// as short lived as possible. Additionally, if you are running in an
/// environment that allows `!Send` futures, you must ensure that the
/// returned `Ref` type is never held alive across an `.await` point.
///
/// The priority policy of the lock is dependent on the underlying lock
/// implementation, and this type does not guarantee that any particular policy
Expand Down

0 comments on commit 45f24f1

Please sign in to comment.