CFRunLoopObserver

Overview

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.

Topics

CFRunLoopObserver Miscellaneous Functions

CFRunLoopObserverCreateWithHandler

Creates a CFRunLoopObserver object with a block-based handler.

CFRunLoopObserverCreate

Creates a CFRunLoopObserver object with a function callback.

CFRunLoopObserverDoesRepeat

Returns a Boolean value that indicates whether a CFRunLoopObserver repeats.

CFRunLoopObserverGetActivities

Returns the run loop stages during which an observer runs.

CFRunLoopObserverGetContext

Returns the context information for a CFRunLoopObserver object.

CFRunLoopObserverGetOrder

Returns the ordering parameter for a CFRunLoopObserver object.

CFRunLoopObserverGetTypeID

Returns the type identifier for the CFRunLoopObserver opaque type.

CFRunLoopObserverInvalidate

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

CFRunLoopObserverIsValid

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

Callbacks

CFRunLoopObserverCallBack

Callback invoked when a CFRunLoopObserver object is fired.

Data Types

CFRunLoopObserverContext

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

CFRunLoopObserverRef

A reference to a run loop observer object.

Constants

CFRunLoopActivity

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

See Also

Opaque Types

CFFileDescriptor

The CFFileDescriptor provides an opaque type to monitor file descriptors for read and write activity via CFRunLoop.

CFStringTokenizer

CFStringTokenizer allows you to tokenize strings into words, sentences or paragraphs in a language-neutral way. It supports languages such as Japanese and Chinese that do not delimit words by spaces, as well as de-compounding German compounds. You can obtain Latin transcription for tokens. It also provides language identification API.