Function

dispatch_after_f

Enqueues an application-defined function for execution at the specified time.

Declaration

void dispatch_after_f(dispatch_time_t when, dispatch_queue_t queue, void *context, dispatch_function_t work);

Parameters

when

The temporal milestone returned by dispatch_time or dispatch_walltime.

queue

The queue on which to submit the function. The queue is retained by the system until the application-defined function has run to completion. This parameter cannot be NULL.

context

The application-defined context parameter to pass to the function.

work

The application-defined function to invoke on the target queue. The first parameter passed to this function is the value in the context parameter. This parameter cannot be NULL.

Discussion

This function waits until the specified time and then asynchronously adds the work function 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.

See Also

Executing Tasks Asynchronously

dispatch_async

Submits a block for asynchronous execution on a dispatch queue and returns immediately.

dispatch_async_f

Submits an application-defined function for asynchronous execution on a dispatch queue and returns immediately.

dispatch_after

Enqueues a block for execution at the specified time.

dispatch_function_t

The prototype of functions submitted to dispatch queues.

dispatch_block_t

The prototype of blocks submitted to dispatch queues, which take no arguments and have no return value.