---
title: IOLockSleep
framework: kernel
role: symbol
role_heading: Function
path: kernel/1553026-iolocksleep
---

# IOLockSleep

Sleep with mutex unlock and relock

## Declaration

```occ
int IOLockSleep(IOLock *lock, void *event, UInt32 interType);
```

## Parameters

- `lock`: Pointer to the locked lock.
- `event`: The event to sleep on.
- `interType`: How can the sleep be interrupted.

## Return Value

Return Value The wait-result value indicating how the thread was awakened.

## Discussion

Discussion Prepare to sleep,unlock the mutex, and re-acquire it on wakeup. Results are undefined if the caller has not locked the mutex. This function may block and so should not be called from interrupt level or while a spin lock is held.

## See Also

### Mutexes

- [IOLockAlloc](kernel/1553021-iolockalloc.md)
- [IOLockInitWithState](kernel/1553028-iolockinitwithstate.md)
- [IOLockFree](kernel/1553034-iolockfree.md)
- [IOTryLock](kernel/1553012-iotrylock.md)
- [IOTakeLock](kernel/1553007-iotakelock.md)
- [IOLockLock](kernel/1553000-iolocklock.md)
- [IOUnlock](kernel/1552994-iounlock.md)
- [IOLockTryLock](kernel/1553018-iolocktrylock.md)
- [IOLockUnlock](kernel/1553006-iolockunlock.md)
- [IOLockWakeup](kernel/1553016-iolockwakeup.md)
- [IOLockSleepDeadline](kernel/1553030-iolocksleepdeadline.md)
- [IOLockGetMachLock](kernel/1553008-iolockgetmachlock.md)
