---
title: Cancel
framework: driverkit
role: symbol
role_heading: Instance Method
path: driverkit/iodataqueuedispatchsource/cancel
---

# Cancel

Cancels all callbacks from the dispatch source.

## Declaration

```occ
virtual kern_return_t Cancel(IODispatchSourceCancelHandler handler);
```

## Parameters

- `handler`: The handler block to call after any in-flight callbacks finish executing.

## Return Value

Return Value kIOReturnSuccess on success, or another value if an error occurs. See Error Codes.

## Discussion

Discussion After cancelling a dispatch source, you cannot reactivate it.

## See Also

### Starting and Stopping the Dispatch Source

- [SetEnableWithCompletion](driverkit/iodataqueuedispatchsource/setenablewithcompletion.md)
