SRWLOCK
Structure SRWLOCK uses pointer-sized storage with embedded flags in the low bits.
Syntax
typedef struct _SRWLOCK {
PVOID Ptr;
} SRWLOCK, *PSRWLOCK;
State Encoding
The Ptr field encodes both state flags and wait block pointers:
Bit 0 — SRWLOCK_OWNED
Lock is currently owned.
Bit 1 — SRWLOCK_CONTENDED
One or more threads are queued.
Bit 2 — SRWLOCK_SHARED
Lock is held in shared mode.
Bit 3 — SRWLOCK_CONTENTION_LOCK
Wait‑block list is being modified.
Bits 4+
Shared reference count or wait‑block pointer.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.1 SDK |
windows.h |
wRTOS_rtss.lib |