We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 11bf3a4 + ce1e67e commit d228c55Copy full SHA for d228c55
1 file changed
src/lib.rs
@@ -40,8 +40,9 @@ impl Emitter {
40
41
tokio::spawn(async move {
42
loop {
43
- while !*listeners_rx.borrow() {
44
- // Wait for an event to be attached
+ // Async-wait until at least one listener is attached
+ if listeners_rx.wait_for(|v| *v).await.is_err() {
45
+ return;
46
}
47
48
let mut watch_stream = nusb::watch_devices().unwrap();
0 commit comments