Fix race when fs events occur right after constructing worktree

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-04-27 16:38:31 -07:00
parent 110dcc48f9
commit 907b537a0b

View file

@ -74,7 +74,7 @@ impl EventStream {
Self::trampoline,
&stream_context,
cf_paths,
fs::kFSEventStreamEventIdSinceNow,
FSEventsGetCurrentEventId(),
latency.as_secs_f64(),
fs::kFSEventStreamCreateFlagFileEvents
| fs::kFSEventStreamCreateFlagNoDefer
@ -285,6 +285,11 @@ impl std::fmt::Display for StreamFlags {
}
}
#[link(name = "CoreServices", kind = "framework")]
extern "C" {
pub fn FSEventsGetCurrentEventId() -> u64;
}
#[test]
fn test_event_stream() {
use std::{fs, sync::mpsc, time::Duration};