System.IO.FileSystemWatcher.RunningInstance.CancellationCallback C# (CSharp) Méthode

CancellationCallback() private méthode

Callback invoked when cancellation is requested. Removes all watches, which will cause the active processing loop to shutdown.
private CancellationCallback ( ) : void
Résultat void
            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();
                }
            }