dispatch_after
Enqueues a block for execution at the specified time.
Declaration
extern void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, dispatch_block_t block);Parameters
- when:
The temporal milestone Dispatch_time or Dispatch_walltime returns.
- queue:
The queue on which to submit the block. The system retains the queue until the block runs to completion. This parameter cannot be
NULL. - block:
The block to submit. This function performs a
Block_copyandBlock_releaseon behalf of the caller. This parameter cannot beNULL.
Discussion
This function waits until the specified time and then asynchronously adds block to the specified queue.
Passing DISPATCH_TIME_NOW as the when parameter is supported, but is not as optimal as calling dispatch_async instead. Passing DISPATCH_TIME_FOREVER is undefined.