This commit is contained in:
sxyazi 2026-02-26 20:35:41 +08:00
parent ef743e235b
commit be5688aed9
No known key found for this signature in database

View file

@ -16,11 +16,12 @@ impl<T> LastValue<T> {
pub async fn get(&self) -> T {
loop {
let notified = self.inner.0.notified();
if let Some(data) = self.inner.1.lock().take() {
return data;
}
self.inner.0.notified().await;
notified.await;
}
}
}