A CFRunLoopObserver provides a general means to receive callbacks at different points within a running run loop. In contrast to sources, which fire when an asynchronous event occurs, and timers, which fire when a particular time passes, observers fire at special locations within the execution of the run loop, such as before sources are processed or before the run loop goes to sleep, waiting for an event to occur. Observers can be either one-time events or repeated every time through the run loop’s loop.

Each run loop observer can be registered in only one run loop at a time, although it can be added to multiple run loop modes within that run loop.


CFRunLoopObserver Miscellaneous Functions

func CFRunLoopObserverDoesRepeat(CFRunLoopObserver!)

Returns a Boolean value that indicates whether a CFRunLoopObserver repeats.

func CFRunLoopObserverGetActivities(CFRunLoopObserver!)

Returns the run loop stages during which an observer runs.

func CFRunLoopObserverGetOrder(CFRunLoopObserver!)

Returns the ordering parameter for a CFRunLoopObserver object.

func CFRunLoopObserverGetTypeID()

Returns the type identifier for the CFRunLoopObserver opaque type.

func CFRunLoopObserverInvalidate(CFRunLoopObserver!)

Invalidates a CFRunLoopObserver object, stopping it from ever firing again.

func CFRunLoopObserverIsValid(CFRunLoopObserver!)

Returns a Boolean value that indicates whether a CFRunLoopObserver object is valid and able to fire.



Callback invoked when a CFRunLoopObserver object is fired.

Data Types


A structure that contains program-defined data and callbacks with which you can configure a CFRunLoopObserver object’s behavior.


A reference to a run loop observer object.



Run loop activity stages in which run loop observers can be scheduled.