private void CancellationCallback()
{
lock (SyncObj)
{
// Remove all watches (inotiy_rm_watch) and clear out the map.
// No additional watches will be added after this point.
foreach (int wd in this._wdToPathMap.Keys)
{
int result = Interop.Sys.INotifyRemoveWatch(_inotifyHandle, wd);
Debug.Assert(result >= 0); // ignore errors; they're non-fatal, but they also shouldn't happen
}
_wdToPathMap.Clear();
}
}