InitializeSRWLock function (synchapi.h)

Initialize a slim reader/writer (SRW) lock.

Syntax

void InitializeSRWLock(
  [out] PSRWLOCK SRWLock
);

Parameters

[out] SRWLock

A pointer to the SRW lock.

Return value

None

Remarks

An SRW lock must be initialized before it is used. The InitializeSRWLock function is used to initialize a SRW lock dynamically. To initialize the structure statically, assign the constant SRWLOCK_INIT to the structure variable.

An SRW lock cannot be moved or copied while in use. The process must not modify the object, and must instead treat it as logically opaque. Only use the SRW functions to manage SRW locks.

An unlocked SRW lock with no waiting threads is in its initial state and can be copied, moved, and forgotten without being explicitly destroyed.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header synchapi.h (include Windows.h on Windows 7, Windows Server 2008 Windows Server 2008 R2)
Library Kernel32.lib
DLL Kernel32.dll

See also

Slim Reader/Writer (SRW) Locks

Synchronization Functions

Vertdll APIs available in VBS enclaves