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

# SetEnableWithCompletion

Enables or disables the dispatch source.

## Declaration

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

## Parameters

- `enable`: A Boolean value that indicates whether to enable or disable the dispatch source. Specify true to enable the timer or false to disable it.
- `handler`: An optional handler block to execute after disabling the dispatch source. The dispatch source calls your handler after any in-flight callbacks finish.

## 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.

## See Also

### Enabling and Disabling the Source

- [SetEnable](driverkit/iodispatchsource/setenable.md)
