---
title: IOLockLock
framework: kernel
role: symbol
role_heading: Function
path: kernel/1553000-iolocklock
---

# IOLockLock

Lock a mutex.

## Declaration

```occ
void IOLockLock(struct IOLock *lock);
```

```occ
void IOLockLock(IOLock *lock);
```

## Parameters

- `lock`: Pointer to the allocated lock.

## Discussion

Discussion Lock the mutex. If the lock is held by any thread, block waiting for its unlock. This function may block and so should not be called from interrupt level or while a spin lock is held. Locking the mutex recursively from one thread will result in deadlock.

## 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)
- [IOUnlock](kernel/1552994-iounlock.md)
- [IOLockTryLock](kernel/1553018-iolocktrylock.md)
- [IOLockUnlock](kernel/1553006-iolockunlock.md)
- [IOLockWakeup](kernel/1553016-iolockwakeup.md)
- [IOLockSleep](kernel/1553026-iolocksleep.md)
- [IOLockSleepDeadline](kernel/1553030-iolocksleepdeadline.md)
- [IOLockGetMachLock](kernel/1553008-iolockgetmachlock.md)
