---
title: IOCommandGate
framework: kernel
role: symbol
role_heading: Class
path: kernel/iocommandgate
---

# IOCommandGate

Single-threaded work-loop client request mechanism.

## Declaration

```occ
class IOCommandGate : IOEventSource
```

## Overview

Overview An IOCommandGate instance is an extremely lightweight mechanism that executes an action on the driver's work-loop. 'On the work-loop' is actually a lie but the work-loop single threaded semantic is maintained for this event source. Using the work-loop gate rather than execution by the workloop. The command gate tests for a potential self dead lock by checking if the runCommand request is made from the work-loop's thread, it doesn't check for a mutual dead lock though where a pair of work loop's dead lock each other. The IOCommandGate is a lighter weight version of the IOCommandQueue and should be used in preference. Generally use a command queue whenever you need a client to submit a request to a work loop. A typical command gate action would check if the hardware is active, if so it will add the request to a pending queue internal to the device or the device's family. Otherwise if the hardware is inactive then this request can be acted upon immediately. CAUTION: The runAction, runCommand, and attemptCommand functions cannot be called from an interrupt context.

## Topics

### 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)
- [runAction](kernel/iocommandgate/1811576-runaction.md)
- [runCommand](kernel/iocommandgate/1811585-runcommand.md)

### Callbacks

- [Action](kernel/ioworkloop/action.md)

### DataTypes

- [ExpansionData](kernel/ioservice/expansiondata.md)

### Instance Variables

- [reserved](kernel/iocommandgate/reserved.md)

### Instance Methods

- [attemptAction](kernel/iocommandgate/1573823-attemptaction.md)
- [attemptCommand](kernel/iocommandgate/1573825-attemptcommand.md)
- [commandSleep](kernel/iocommandgate/1573818-commandsleep.md)
- [commandSleep](kernel/iocommandgate/3516447-commandsleep.md)
- [commandWakeup](kernel/iocommandgate/1573826-commandwakeup.md)
- [disable](kernel/iocommandgate/1573828-disable.md)
- [enable](kernel/iocommandgate/1573822-enable.md)
- [free](kernel/iocommandgate/1573821-free.md)
- [getMetaClass](kernel/iocommandgate/1573820-getmetaclass.md)
- [init](kernel/iocommandgate/1573817-init.md)
- [runAction](kernel/iocommandgate/1573816-runaction.md)
- [runActionBlock](kernel/iocommandgate/2967266-runactionblock.md)
- [runCommand](kernel/iocommandgate/1573824-runcommand.md)
- [setWorkLoop](kernel/iocommandgate/1573827-setworkloop.md)

### Type Methods

- [commandGate](kernel/iocommandgate/1573819-commandgate.md)

## Relationships

### Inherits From

- [IOEventSource](kernel/ioeventsource.md)

## See Also

### Base Types

- [IOCommandPool](kernel/iocommandpool.md)
- [IOCommand](kernel/iocommand.md)
- [IODispatchSource](kernel/iodispatchsource.md)
- [IOEventSource](kernel/ioeventsource.md)
