---
title: init
framework: kernel
role: pseudoSymbol
path: kernel/iocommandgate/1811560-init
---

# init

Class initialiser.

## Declaration

```occ
virtual bool init(
 OSObject *owner,
 Action action = 0); 
```

## Parameters

- `owner`: Owner of this, newly created, instance of the IOCommandGate. This argument will be used as the first parameter in the action callout.
- `action`: Pointer to a C function that is called whenever a client of the IOCommandGate calls runCommand. NB Can be a C++ member function but caller must cast the member function to $link IOCommandGate::Action and they will get a compiler warning. Defaults to zero, see $link IOEventSource::setAction.

## Return Value

Return Value True if inherited classes initialise successfully.

## Overview

Overview Initialiser for IOCommandGate operates only on newly 'newed' objects. Shouldn't be used to re-init an existing instance.

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