A scoped lock for exclusive access to the state of the primary log thread.
The primary lock has the same access as the read lock, and:
- Must not be entered when the thread holds a write lock or primary lock.
- Must check IsLocked() before performing restricted operations.
- Must be locked to write to buffered output devices.
- Must be locked while calling FlushBufferedItems().
- May be locked when the thread holds a read lock.
- When a panic thread is active, locking will only succeed from the panic thread.