<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_after_f",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_after_f"
  },
  "title" : "dispatch_after_f"
}
-->

# dispatch_after_f

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

```
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`](/documentation/Dispatch/dispatch_time) or [`dispatch_walltime`](/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

This function waits until the specified time and then asynchronously adds the `work` function to the specified `queue`.

Passing [`DISPATCH_TIME_NOW`](/documentation/Dispatch/DISPATCH_TIME_NOW) as the `when` parameter is supported, but is not as optimal as calling [`dispatch_async`](/documentation/Dispatch/dispatch_async) instead. Passing [`DISPATCH_TIME_FOREVER`](/documentation/Dispatch/DISPATCH_TIME_FOREVER) is undefined.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)