The File System Events API consists of several distinct groups of functions. You can obtain general information about volumes and events by using functions that begin with FSEvents. You can create a new event stream, perform operations on the stream, and so on using functions that begin with FSEventStream.
The life cycle of a file system events stream is as follows:
The application creates a stream by calling FSEventStreamCreate or FSEventStreamCreateRelativeToDevice. The stream initially has a retain count of 1. If desired, you can increment this count by calling FSEventStreamRetain.
The application schedules the stream on the run loop by calling FSEventStreamScheduleWithRunLoop.
The application tells the file system events daemon to start sending events by calling FSEventStreamStart.
The application services events as they arrive. The API posts events by calling the callback function specified in step 1.
The application tells the daemon to stop sending events by calling FSEventStreamStop.
If the application needs to restart the stream, go to step 3.
The application unschedules the event from its run loop by calling FSEventStreamUnscheduleFromRunLoop.
The application invalidates the stream by calling FSEventStreamInvalidate.
The application releases its reference to the stream by calling FSEventStreamRelease.
These steps are explained in more detail in the sections that follow.
Adding Include Directives
Creating an Event Stream
Handling Events
Using Persistent Events
Building a Directory Hierarchy Snapshot
Cleaning Up
Special Considerations for Per-Device Streams
Last updated: 2008-03-11