Ignore sentinel events for the FSEvents watcher.

This caused the watcher to be endlessly recreated in rapid succession.
This commit is contained in:
Sönke Ludwig 2020-05-27 17:57:27 +02:00
parent 9120982bed
commit 8695b4d32c

View file

@ -338,6 +338,13 @@ final class FSEventsEventDriverWatchers(Events : EventDriverEvents) : EventDrive
auto flagsarr = () @trusted { return eventFlags[0 .. numEvents]; } (); auto flagsarr = () @trusted { return eventFlags[0 .. numEvents]; } ();
auto idarr = () @trusted { return eventIds[0 .. numEvents]; } (); auto idarr = () @trusted { return eventIds[0 .. numEvents]; } ();
if (flagsarr[0] & kFSEventStreamEventFlagHistoryDone) {
if (!--numEvents) return;
patharr = patharr[1 .. $];
flagsarr = flagsarr[1 .. $];
idarr = idarr[1 .. $];
}
// A new stream needs to be created after every change, because events // A new stream needs to be created after every change, because events
// get coalesced per file (event flags get or'ed together) and it becomes // get coalesced per file (event flags get or'ed together) and it becomes
// impossible to determine the actual event // impossible to determine the actual event