---
title: IOSimpleLockLock
framework: kernel
role: symbol
role_heading: Function
path: kernel/1552997-iosimplelocklock
---

# IOSimpleLockLock

Lock a spin lock.

## Declaration

```occ
void IOSimpleLockLock(IOSimpleLock *lock);
```

## Parameters

- `lock`: Pointer to the lock.

## Discussion

Discussion Lock the spin lock. If the lock is held, spin waiting for its unlock. Spin locks disable preemption, cannot be held across any blocking operation, and should be held for very short periods. When used to synchronize between interrupt context and thread context they should be locked with interrupts disabled - IOSimpleLockLockDisableInterrupt() will do both. Locking the lock recursively from one thread will result in deadlock.

## See Also

### Simple Locks

- [IOSimpleLockAlloc](kernel/1553017-iosimplelockalloc.md)
- [IOSimpleLockInit](kernel/1552990-iosimplelockinit.md)
- [IOSimpleLockDestroy](kernel/3380136-iosimplelockdestroy.md)
- [IOSimpleLockFree](kernel/1553035-iosimplelockfree.md)
- [IOSimpleLockGetMachLock](kernel/1553019-iosimplelockgetmachlock.md)
- [IOSimpleLockLockDisableInterrupt](kernel/1553005-iosimplelocklockdisableinterrupt.md)
- [IOSimpleLockTryLock](kernel/1553029-iosimplelocktrylock.md)
- [IOSimpleLockUnlock](kernel/1553015-iosimplelockunlock.md)
- [IOSimpleLockUnlockEnableInterrupt](kernel/1552998-iosimplelockunlockenableinterrup.md)
