---
title: dispatch_after_f
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatch_after_f
---

# dispatch_after_f

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

## Declaration

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

## Parameters

- `when`: The temporal milestone doc://com.apple.dispatch/documentation/Dispatch/dispatch_time or doc://com.apple.dispatch/documentation/Dispatch/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

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](dispatch/dispatch_async.md)
- [dispatch_async_f](dispatch/dispatch_async_f.md)
- [dispatch_after](dispatch/dispatch_after.md)
- [dispatch_function_t](dispatch/dispatch_function_t.md)
- [dispatch_block_t](dispatch/dispatch_block_t.md)
