---
title: "commandSleep(void *, UInt32)"
framework: kernel
role: pseudoSymbol
path: kernel/iocommandgate/1811498-commandsleep
---

# commandSleep(void *, UInt32)

Put a thread that is currently holding the command gate to sleep.

## Declaration

```occ
virtual IOReturn commandSleep(
 void *event, 
 UInt32 interruptible = interruptible); 
```

## Parameters

- `event`: Pointer to an address.
- `interruptible`: THREAD_UNINT, THREAD_INTERRUPTIBLE or THREAD_ABORTSAFE. THREAD_UNINT specifies that the sleep cannot be interrupted by a signal. THREAD_INTERRUPTIBLE specifies that the sleep may be interrupted by a "kill -9" signal. THREAD_ABORTSAFE (the default value) specifies that the sleep may be interrupted by any user signal.

## Return Value

Return Value THREAD_AWAKENED - normal wakeup, THREAD_TIMED_OUT - timeout expired, THREAD_INTERRUPTED - interrupted, THREAD_RESTART - restart operation entirely, kIOReturnNotPermitted if the calling thread does not hold the command gate.

## Overview

Overview Put a thread to sleep waiting for an event but release the gate first. If the event occurs then the commandGate is closed before the function returns.

## 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)
- [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)
