---
title: SetEnableWithCompletion
framework: driverkit
role: symbol
role_heading: Instance Method
path: driverkit/iointerruptdispatchsource/setenablewithcompletion
---

# SetEnableWithCompletion

Enables or disables the delivery of interrupts.

## Declaration

```occ
virtual kern_return_t SetEnableWithCompletion(bool enable, IODispatchSourceCancelHandler handler);
```

## Parameters

- `enable`: A Boolean value that indicates whether to enable the dispatch source. Specify true to enable the dispatch source, or false to disable it.
- `handler`: An optional block to execute when disabling the dispatch source. The dispatch source executes it after all pending interrupts finish executing.

## Return Value

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

## See Also

### Starting and Stopping the Interrupt Source

- [Cancel](driverkit/iointerruptdispatchsource/cancel.md)
- [IODispatchSourceCancelHandler](driverkit/iodispatchsourcecancelhandler.md)
