TryAcquireSRWLockExclusive

TryAcquireSRWLockExclusive attempts to acquire the SRW lock in exclusive mode.

Syntax

BOOL TryAcquireSRWLockExclusive(   
    PSRWLOCK pSrwLock
);

Parameters

pSrwLock

A pointer to the SRW lock to acquire.

Return Value

Returns TRUE if the lock was successfully acquired, FALSE otherwise.

Remarks

Requirements

Minimum Supported Version RTX64 4.5.5
Header windows.h
Library Rtx_Rtss.lib

Example

Copy
if (TryAcquireSRWLockExclusive(&lock)) {
    // Successfully acquired
    // Perform operations
    ReleaseSRWLockExclusive(&lock);
} else {
    // Lock was busy, handle appropriately
}

See Also: