<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOTimerDispatchSource/SetEnableWithCompletion",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOTimerDispatchSource@F@SetEnableWithCompletion#b#BFv()#"
  },
  "title" : "SetEnableWithCompletion"
}
-->

# SetEnableWithCompletion

Enables or disables the timer.

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

## Parameters

`enable`

A Boolean value that indicates whether to enable or disable the timer. Specify <doc://com.apple.documentation/documentation/Swift/true> to enable the timer or <doc://com.apple.documentation/documentation/Swift/false> to disable it.

`handler`

An optional block to execute after any pending handlers of a newly disabled timer finish executing.

## Return Value

[`kIOReturnSuccess`](/documentation/DriverKit/kIOReturnSuccess) on success, or another value if an error occurs. See [Error Codes](/documentation/DriverKit/error-codes).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)