---
title: IOSimpleLockAlloc
framework: kernel
role: symbol
role_heading: Function
path: kernel/1553017-iosimplelockalloc
---

# IOSimpleLockAlloc

Allocates and initializes a spin lock.

## Declaration

```occ
IOSimpleLock * IOSimpleLockAlloc(void);
```

## Return Value

Return Value Pointer to the allocated lock, or zero on failure.

## Discussion

Discussion Allocates and initializes a spin lock in general purpose memory. Spin locks provide non-blocking mutual exclusion for synchronization between thread context and interrupt context, or for multiprocessor synchronization, and are supplied by libkern/locks.h. This function may block and so should not be called from interrupt level or while a spin lock is held. IOSimpleLocks use the global IOKit lock group, IOLockGroup. To simplify kext debugging and lock-heat analysis, consider using lck_* locks with a per-driver lock group, as defined in kern/locks.h.

## See Also

### Simple Locks

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