---
title: IORWLockWrite
framework: kernel
role: symbol
role_heading: Function
path: kernel/1552996-iorwlockwrite
---

# IORWLockWrite

Lock a read/write lock for write.

## Declaration

```occ
void IORWLockWrite(struct IORWLock *lock);
```

```occ
void IORWLockWrite(IORWLock *lock);
```

## Parameters

- `lock`: Pointer to the allocated lock.

## Discussion

Discussion Lock the lock for write, allowing one writer exlusive access. If the lock is held for read or write, 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 lock recursively from one thread, for read or write, can result in deadlock.

## See Also

### Read/Write Locks

- [IORWLockAlloc](kernel/1553010-iorwlockalloc.md)
- [IORWLockFree](kernel/1553003-iorwlockfree.md)
- [IORWLockGetMachLock](kernel/1553033-iorwlockgetmachlock.md)
- [IORWLockRead](kernel/1553004-iorwlockread.md)
- [IORWLockUnlock](kernel/1553011-iorwlockunlock.md)
- [IORWUnlock](kernel/1553027-iorwunlock.md)
- [IOWriteLock](kernel/1552985-iowritelock.md)
- [IOReadLock](kernel/1553022-ioreadlock.md)
