AcquireSRWLockShared
AcquireSRWLockShared acquires the SRW lock in shared mode. Multiple threads can hold the lock in shared mode simultaneously, allowing concurrent read access. If an exclusive lock is held, the calling thread blocks until the lock can be acquired in shared mode.
Syntax
VOID AcquireSRWLockShared(
PSRWLOCK pSrwLock
);
Parameters
pSrwLock
A pointer to the SRW lock to acquire.
Return Value
This function does not return a value.
Remarks
- This function blocks the calling thread until the lock can be acquired in shared mode.
- Multiple threads can hold the lock in shared mode concurrently.
- The lock cannot be acquired while a thread holds the lock in exclusive mode.
- This function increments the shared reference count.
- This function raises EXCEPTION_ACCESS_VIOLATION if pSrwLock is NULL.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.1 SDK |
windows.h |
wRTOS_rtss.lib |
Example
SRWLOCK lock;
InitializeSRWLock(&lock);
AcquireSRWLockShared(&lock);
// Perform read-only operations
ReleaseSRWLockShared(&lock);
See Also: