Acquires a fat read/write for exclusive access, optionally waiting until access can be granted.
Syntax
BOOLEAN WINAPI RtlAcquireResourceExclusive (
PRTL_RESOURCE pRes,
BOOLEAN bWaitForAccess
)
Parameters
- pRes
- A pointer to the resource object to exclusively acquire
- bWaitForAccess
- Boolean value specifying whether the function can wait for access to be granted
Return Value
Nonzero if exclusive access was granted, zero if not
Remarks
Each call to this function must be balanced by a call to RtlReleaseResource.
If the calling thread already has exclusive access to the resource, access is granted trivially. If the calling thread has shared access and bWaitForAccess is nonzero, the thread will be stuck for three times the timeout period before the function raises a STATUS_POSSIBLE_DEADLOCK exception.
The default timeout period is the value of Peb->CriticalSectionTimeout unless pRes->flags & 1 is nonzero, in which case the timeout is infinite.