diff options
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.rs b/src/util.rs index faeea79..ba485bf 100644 --- a/src/util.rs +++ b/src/util.rs @@ -32,9 +32,9 @@ where /// ) /// ``` pub async fn await_exit(mut must_exit: watch::Receiver<bool>) { - loop { - if must_exit.recv().await == Some(true) { - return; + while !*must_exit.borrow_and_update() { + if must_exit.changed().await.is_err() { + break; } } } |