About Dispatch Sources
A dispatch source is a fundamental data type that coordinates the processing of specific low-level systemevents. Grand Central Dispatch supports the following types of dispatch sources:
Timer dispatch sources generate periodic notifications.
Signal dispatch sources notify you when a UNIX signal arrives.
Descriptor sources notify you of various file- and socket-based operations, such as:
When data is available for reading
When it is possible to write data
When files are deleted, moved, or renamed in the file systemWhen file meta information changes
Process dispatch sources notify you of process-related events, such as:When a process exits
When a process issues a fork or exec type of call
When a signal is delivered to the process
Mach port dispatch sources notify you of Mach-related events.Custom dispatch sources are ones you define and trigger yourself.
When you configure a dispatch source, you specify the events you want to monitor and the dispatchqueue and code to use to process those events. You can specify your code using block objects or functions.When an event of interest arrives, the dispatch source submits your block or function to the specified dispatchqueue for execution.