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

# Cancel

Cancels all callbacks from the event 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 After cancellation, the source can only be freed. It cannot be reactivated.

## See Also

### Starting and Stopping the Timer Source

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