<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IODispatchSource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IODispatchSource"
  },
  "title" : "IODispatchSource"
}
-->

# IODispatchSource

The common base class for dispatch sources.

```
class IODispatchSource;
```

## Topics

### Configuring the Dispatch Source

[`virtual bool init();`](/documentation/DriverKit/IODispatchSource/init)

Handles the basic initialization of the dispatch source.

[`virtual void free();`](/documentation/DriverKit/IODispatchSource/free)

Performs any final cleanup for the dispatch source.

[`virtual kern_return_t Cancel(IODispatchSourceCancelHandler handler);`](/documentation/DriverKit/IODispatchSource/Cancel)

Cancel all callbacks from the dispatch source.

### Enabling and Disabling the Source

[`virtual kern_return_t SetEnable(bool enable);`](/documentation/DriverKit/IODispatchSource/SetEnable)

Enables or disables the delivery of events to your code.

[`virtual kern_return_t SetEnableWithCompletion(bool enable, IODispatchSourceCancelHandler handler);`](/documentation/DriverKit/IODispatchSource/SetEnableWithCompletion)

Enables or disables the dispatch source.

### Checking the State of the Source

[`virtual kern_return_t CheckForWork(bool synchronous);`](/documentation/DriverKit/IODispatchSource/CheckForWork)

Checks for events to handle.

## Relationships

### Inherited By

[`IOServiceNotificationDispatchSource`](/documentation/DriverKit/IOServiceNotificationDispatchSource)

[`IOServiceStateNotificationDispatchSource`](/documentation/DriverKit/IOServiceStateNotificationDispatchSource)

[`IODataQueueDispatchSource`](/documentation/DriverKit/IODataQueueDispatchSource)

[`IOTimerDispatchSource`](/documentation/DriverKit/IOTimerDispatchSource)

[`IOInterruptDispatchSource`](/documentation/DriverKit/IOInterruptDispatchSource)

### Inherits From

[`OSObject`](/documentation/DriverKit/OSObject)

---

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)