Contents

dispatch_after_f

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

Declaration

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

Parameters

  • when:

    The temporal milestone Dispatch_time or Dispatch_walltime returns.

  • queue:

    The queue on which to submit the function. The system retains the queue until the app-defined function runs to completion. This parameter cannot be NULL.

  • context:

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

  • work:

    The app-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