---
title: runAction
framework: kernel
role: pseudoSymbol
path: kernel/iocommandgate/1811576-runaction
---

# runAction

Single thread a call to an action with the target work-loop.

## Declaration

```occ
virtual IOReturn runAction(
 Action action, 
 void *arg0 = 0,
 void *arg1 = 0, 
 void *arg2 = 0,
 void *arg3 = 0); 
```

## Parameters

- `action`: Pointer to function to be executed in work-loop context.
- `arg0`: Parameter for action parameter, defaults to 0.
- `arg1`: Parameter for action parameter, defaults to 0.
- `arg2`: Parameter for action parameter, defaults to 0.
- `arg3`: Parameter for action parameter, defaults to 0.

## Return Value

Return Value kIOReturnSuccess if successful. kIOReturnBadArgument if action is not defined, kIOReturnAborted if a disabled command gate is free()ed before being reenabled.

## Overview

Overview Client function that causes the given action to be called in a single threaded manner. Beware the work-loop's gate is recursive and command gates can cause direct or indirect re-entrancy. When the executing on a client's thread runAction will sleep until the work-loop's gate opens for execution of client actions, the action is single threaded against all other work-loop event sources. If the command is disabled the attempt to run a command will be stalled until enable is called.

## See Also

### Miscellaneous

- [attemptAction](kernel/iocommandgate/1811105-attemptaction.md)
- [attemptCommand](kernel/iocommandgate/1811141-attemptcommand.md)
- [commandGate](kernel/iocommandgate/1811293-commandgate.md)
- [commandSleep(void *, AbsoluteTime, UInt32)](kernel/iocommandgate/1811482-commandsleep.md)
- [commandSleep(void *, UInt32)](kernel/iocommandgate/1811498-commandsleep.md)
- [commandWakeup](kernel/iocommandgate/1811517-commandwakeup.md)
- [disable](kernel/iocommandgate/1811531-disable.md)
- [enable](kernel/iocommandgate/1811547-enable.md)
- [init](kernel/iocommandgate/1811560-init.md)
- [runCommand](kernel/iocommandgate/1811585-runcommand.md)
