setRegistrationHandler(handler:)
Sets the registration handler work item for the dispatch source.
Declaration
func setRegistrationHandler(handler: DispatchWorkItem)Parameters
- handler:
The event handler block to submit to the source’s target queue.
Discussion
The registration handler (if specified) is submitted to the source’s target queue as soon as the source has been fully set up and is ready to start delivering events. The set up of a dispatch source’s underlying event-delivery mechanism occurs asynchronously.
Installing a registration handler is a way to be notified when that set up is complete and the dispatch source is ready to start delivering events. After your operation handler is executed, the dispatch source uninstalls it. As such, registration handlers are executed only once after you resume the dispatch source. If you set a registration handler on a dispatch source that is already set-up and running, the handler is invoked immediately.