mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
sync: tweak watch API (#2814)
Decouples getting the latest `watch` value from receiving the change notification. The `Receiver` async method becomes `Receiver::changed()`. The latest value is obtained from `Receiver::borrow()`. The implementation is updated to use `Notify`. This requires adding `Notify::notify_waiters`. This method is generally useful but is kept private for now.
This commit is contained in:
@@ -205,7 +205,7 @@ async_assert_fn!(tokio::sync::Mutex<Rc<u8>>::lock(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<u8>::lock_owned(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Cell<u8>>::lock_owned(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Rc<u8>>::lock_owned(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::Notify::notified(_): Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::Notify::notified(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::RwLock<u8>::read(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::RwLock<u8>::write(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::RwLock<Cell<u8>>::read(_): !Send & !Sync);
|
||||
@@ -229,9 +229,7 @@ async_assert_fn!(tokio::sync::mpsc::UnboundedReceiver<u8>::recv(_): Send & Sync)
|
||||
async_assert_fn!(tokio::sync::mpsc::UnboundedReceiver<Cell<u8>>::recv(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::mpsc::UnboundedReceiver<Rc<u8>>::recv(_): !Send & !Sync);
|
||||
|
||||
async_assert_fn!(tokio::sync::watch::Receiver<u8>::recv(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Receiver<Cell<u8>>::recv(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Receiver<Rc<u8>>::recv(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Receiver<u8>::changed(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Sender<u8>::closed(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Sender<Cell<u8>>::closed(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::watch::Sender<Rc<u8>>::closed(_): !Send & !Sync);
|
||||
|
||||
Reference in New Issue
Block a user