C# Class System.IO.FileSystemWatcher.RunningInstance

State and processing associatd with an active watch operation. This state is kept separate from FileSystemWatcher to avoid race conditions when a user starts/stops/starts/stops/etc. in quick succession, resulting in the potential for multiple active operations. It also helps with avoiding rooted cycles and enabling proper finalization.
Afficher le fichier Open project: dotnet/corefx

Private Properties

Свойство Type Description
AddDirectoryWatch void
AddDirectoryWatchUnlocked void
CancellationCallback void
ProcessEvents void
ReadName string
RemoveWatchedDirectory void
RemoveWatchedDirectoryUnlocked void
RunningInstance Microsoft.Win32.SafeHandles
Start void
TryReadEvent bool

Private Methods

Méthode Description
AddDirectoryWatch ( WatchedDirectory parent, string directoryName ) : void

Adds a watch on a directory to the existing inotify handle.

AddDirectoryWatchUnlocked ( WatchedDirectory parent, string directoryName ) : void

Adds a watch on a directory to the existing inotify handle.

CancellationCallback ( ) : void

Callback invoked when cancellation is requested. Removes all watches, which will cause the active processing loop to shutdown.

ProcessEvents ( ) : void

Main processing loop. This is currently implemented as a synchronous operation that continually reads events and processes them... in the future, this could be changed to use asynchronous processing if the impact of using a thread-per-FileSystemWatcher is too high.

ReadName ( int position, int nameLength ) : string

Reads a UTF8 string from _buffer starting at the specified position and up to the specified length. Null termination is trimmed off (the length may include many null bytes, not just one, or it may include none).

RemoveWatchedDirectory ( WatchedDirectory directoryEntry, bool removeInotify = true ) : void

Removes the watched directory from our state, and optionally removes the inotify watch itself.

RemoveWatchedDirectoryUnlocked ( WatchedDirectory directoryEntry, bool removeInotify ) : void

Removes the watched directory from our state, and optionally removes the inotify watch itself.

RunningInstance ( FileSystemWatcher watcher, SafeFileHandle inotifyHandle, string directoryPath, bool includeSubdirectories, Interop notifyFilters, CancellationToken cancellationToken ) : Microsoft.Win32.SafeHandles

Initializes the instance with all state necessary to operate a watch.

Start ( ) : void
TryReadEvent ( NotifyEvent &notifyEvent ) : bool

Read events from the inotify handle into the supplied array.