O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

FSEvents API

The FSEvents notification mechanism is a runloop source, sitting around waiting for stuff to happen. A C callback function is called when a message from fseventsd shows up. The FSEventsStreamRef type is what you use to reference a particular event stream.

Creating the stream

Before you can start receiving events, you need to create the event stream with one of these two functions:

FSEventStreamRef FSEventStreamCreate (CFAllocatorRef allocator,
                                      FSEventStreamCallback callback,
                                      FSEventStreamContext *context,
                                      CFArrayRef pathsToWatch,
                                      FSEventStreamEventId sinceWhen,
                                      CFTimeInterval latency,
                                      FSEventStreamCreateFlags flags);

or

FSEventStreamRef 
FSEventStreamCreateRelativeToDevice (CFAllocatorRef allocator, FSEventStreamCallback callback, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required