<!--
{
  "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_source_get_data",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_source_get_data"
  },
  "title" : "dispatch_source_get_data"
}
-->

# dispatch_source_get_data

Returns pending data for the dispatch source.

```
extern uintptr_t dispatch_source_get_data(dispatch_source_t source);
```

## Parameters

`source`

This parameter cannot be `NULL`.

## Discussion

### Return Value

The return value should be interpreted according to the type of the dispatch source, and can be one of the following:

- [`DISPATCH_SOURCE_TYPE_DATA_ADD`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_DATA_ADD): application-defined data
- [`DISPATCH_SOURCE_TYPE_DATA_OR`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_DATA_OR): application-defined data
- [`DISPATCH_SOURCE_TYPE_MACH_SEND`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_MACH_SEND): `Dispatch Source Mach Send Event Flags`
- [`DISPATCH_SOURCE_TYPE_MACH_RECV`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_MACH_RECV): not applicable
- [`DISPATCH_SOURCE_TYPE_PROC`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_PROC): `Dispatch Source Process Event Flags`
- [`DISPATCH_SOURCE_TYPE_READ`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_READ): estimated bytes available to read
- [`DISPATCH_SOURCE_TYPE_SIGNAL`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_SIGNAL): number of signals delivered since the last handler invocation
- [`DISPATCH_SOURCE_TYPE_TIMER`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_TIMER): number of times the timer has fired since the last handler invocation
- [`DISPATCH_SOURCE_TYPE_VNODE`](/documentation/Dispatch/DISPATCH_SOURCE_TYPE_VNODE): `Dispatch Source Vnode Event Flags`
- `Dispatch Source Memory Pressure Event Flags`: estimated buffer space available

## Discussion

Call this function from within the event handler block. The result of calling this function outside of the event handler callback 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)