Dispatch Sources

Dispatch sources represent streams of events. When an event associated with a dispatch source occurs, an event handler (such as a block) is scheduled on a designated queue. You make a new dispatch source with dispatch_source_create():

dispatch_source_t dispatch_source_create (dispatch_source_type_t type,
                                          uintptr_t handle,
                                          unsigned long mask,
                                          dispatch_queue_t queue);

type is one of these constants:

 ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​D​A​T​A​_​A​D​D​ ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​D​A​T​A​_​O​R​ ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​M​A​C​H​_​S​E​N​D​ ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​M​A​C​H​_​R​E​C​V​ ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​P​R​O​C​ ​ ​D​I​S​P​A​T​C​H​_​S​O​U​R​C​E​_​T​Y​P​E​_​R​E​A​D​ ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.