1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

Fix race condition in file watcher (#9105)

This commit is contained in:
Bert Belder 2021-01-12 22:26:44 -08:00
parent ca07bab594
commit 060bfe7df8
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -55,8 +55,7 @@ impl Stream for Debounce {
self: Pin<&mut Self>, self: Pin<&mut Self>,
cx: &mut Context, cx: &mut Context,
) -> Poll<Option<Self::Item>> { ) -> Poll<Option<Self::Item>> {
if self.event_detected.load(Ordering::Relaxed) { if self.event_detected.swap(false, Ordering::Relaxed) {
self.event_detected.store(false, Ordering::Relaxed);
Poll::Ready(Some(())) Poll::Ready(Some(()))
} else { } else {
let mut timer = self.project().timer; let mut timer = self.project().timer;