<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/OSAction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@OSAction"
  },
  "title" : "OSAction"
}
-->

# OSAction

An object that executes your driver’s custom behavior.

```
class OSAction;
```

## Overview

An [`OSAction`](/documentation/DriverKit/OSAction) object encapsulates a custom method of your driver, and the object that contains that method. When configuring your driver, you use action objects in places where the system must call your custom code asynchronously. For example, a timer dispatch source notifies its action object when the specified time elapses. Because actions execute asynchronously, store any state information your action requires in the object you specify at configuration time.

Create action objects using the method generated by the [`TYPE`](/documentation/DriverKit/TYPE) macro. When you append that macro to a method declaration in your `.iig` file, the compiler automatically generates a method with the name `CreateAction`*<MethodName>*. For example, if the name of your custom method is `HandleTimer`, the name of the system-generated method is `CreateActionHandleTimer`. This generated method creates an action object already configured to call your custom method.

## Topics

### Configuring the Action

[`free`](/documentation/DriverKit/OSAction/free)

Performs any final cleanup for the action object.

[`SetAbortedHandler`](/documentation/DriverKit/OSAction/SetAbortedHandler)

Install a handler for the system to call when no other processes reference the action object.

### Getting State Information

[`GetReference`](/documentation/DriverKit/OSAction/GetReference)

Returns a pointer to any additional memory allocated by the action object on your behalf.

### Ending the Action Early

[`Cancel`](/documentation/DriverKit/OSAction/Cancel)

Cancels the execution of the action’s callbacks.

[`Aborted`](/documentation/DriverKit/OSAction/Aborted)

Calls the abort handler of the action object.

[`OSActionAbortedHandler`](/documentation/DriverKit/OSActionAbortedHandler)

The block to call before aborting an action object.

[`OSActionCancelHandler`](/documentation/DriverKit/OSActionCancelHandler)

The block to call after the successful cancellation of the action.

### Instance Methods

[`EndWait`](/documentation/DriverKit/OSAction/EndWait)

[`Wait`](/documentation/DriverKit/OSAction/Wait)

[`WillWait`](/documentation/DriverKit/OSAction/WillWait)



---

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)