---
title: SetHandler
framework: driverkit
role: symbol
role_heading: Instance Method
path: driverkit/iointerruptdispatchsource/sethandler
---

# SetHandler

Set the handler block to run when the interrupt fires.

## Declaration

```occ
virtual kern_return_t SetHandler(OSAction *action);
```

## Parameters

- `action`: An doc://com.apple.driverkit/documentation/DriverKit/OSAction object that specifies the method to call when an interrupt occurs. The system retains this doc://com.apple.driverkit/documentation/DriverKit/OSAction object until you call this method with a different action object or you cancel the dispatch source.

## Return Value

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

## See Also

### Configuring the Interrupt Source

- [Create](driverkit/iointerruptdispatchsource/create.md)
- [init](driverkit/iointerruptdispatchsource/init.md)
- [free](driverkit/iointerruptdispatchsource/free.md)
