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

# Cancel

Cancel all callbacks from the dispatch source.

## Declaration

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

## Parameters

- `handler`: The handler block to execute after the dispatch source finishes any in-flight callbacks.

## Return Value

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

## Discussion

Discussion Subclasses must provide an implementation of this method. After cancellation, the dispatch source can only be freed. It cannot be reactivated.

## See Also

### Configuring the Dispatch Source

- [init](driverkit/iodispatchsource/init.md)
- [free](driverkit/iodispatchsource/free.md)
