24#define InterlockedBitTestAndSetPointer(ptr,val) InterlockedBitTestAndSet64((PLONGLONG)ptr,(LONGLONG)val)
25#define InterlockedAddPointer(ptr,val) InterlockedAdd64((PLONGLONG)ptr,(LONGLONG)val)
26#define InterlockedAndPointer(ptr,val) InterlockedAnd64((PLONGLONG)ptr,(LONGLONG)val)
27#define InterlockedOrPointer(ptr,val) InterlockedOr64((PLONGLONG)ptr,(LONGLONG)val)
30#define InterlockedBitTestAndSetPointer(ptr,val) InterlockedBitTestAndSet((PLONG)ptr,(LONG)val)
31#define InterlockedAddPointer(ptr,val) InterlockedAdd((PLONG)ptr,(LONG)val)
32#define InterlockedAndPointer(ptr,val) InterlockedAnd((PLONG)ptr,(LONG)val)
33#define InterlockedOrPointer(ptr,val) InterlockedOr((PLONG)ptr,(LONG)val)
37#define RTL_SRWLOCK_OWNED_BIT 0
38#define RTL_SRWLOCK_CONTENDED_BIT 1
39#define RTL_SRWLOCK_SHARED_BIT 2
40#define RTL_SRWLOCK_CONTENTION_LOCK_BIT 3
41#define RTL_SRWLOCK_OWNED (_ONE << RTL_SRWLOCK_OWNED_BIT)
42#define RTL_SRWLOCK_CONTENDED (_ONE << RTL_SRWLOCK_CONTENDED_BIT)
43#define RTL_SRWLOCK_SHARED (_ONE << RTL_SRWLOCK_SHARED_BIT)
44#define RTL_SRWLOCK_CONTENTION_LOCK (_ONE << RTL_SRWLOCK_CONTENTION_LOCK_BIT)
45#define RTL_SRWLOCK_MASK (RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED | \
46 RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENTION_LOCK)
47#define RTL_SRWLOCK_BITS 4
99 if (!FirstWaitBlock->Exclusive)
105 Next->SharedCount = FirstWaitBlock->SharedCount;
110 Next->Last = FirstWaitBlock->Last;
115 if (FirstWaitBlock->Exclusive)
119 ASSERT(FirstWaitBlock->SharedCount > 0);
128 if (FirstWaitBlock->Exclusive)
139 WakeChain = FirstWaitBlock->SharedWakeChain;
142 NextWake = WakeChain->
Next;
147 WakeChain = NextWake;
148 }
while (WakeChain !=
NULL);
164 ASSERT(FirstWaitBlock->Exclusive);
173 Next->Last = FirstWaitBlock->Last;
239 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
244 if (WaitBlock->Wake != 0)
271 if (FirstWait !=
NULL)
273 while (WakeChain->Wake == 0)
284 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
293 if (WakeChain->Wake != 0)
334 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
349 if (
First->Exclusive)
355 Shared =
First->Last;
362 StackWaitBlock.
Last = &StackWaitBlock;
365 Shared->
Next = &StackWaitBlock;
366 First->Last = &StackWaitBlock;
368 Shared = &StackWaitBlock;
369 FirstWait = &StackWaitBlock;
414 (
PVOID)CurrentValue) == CurrentValue)
438 StackWaitBlock.
Last = &StackWaitBlock;
444 Shared =
First->Last;
447 Shared->
Next = &StackWaitBlock;
448 First->Last = &StackWaitBlock;
450 Shared = &StackWaitBlock;
451 FirstWait = &StackWaitBlock;
482 StackWaitBlock.
Last = &StackWaitBlock;
489 (
PVOID)CurrentValue) == CurrentValue)
511 (
PVOID)CurrentValue) == CurrentValue)
534 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
543 if (WaitBlock !=
NULL)
570 (
PVOID)CurrentValue) == CurrentValue)
603 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
620 StackWaitBlock.
Last = &StackWaitBlock;
621 StackWaitBlock.
Wake = 0;
627 (
PVOID)CurrentValue) == CurrentValue)
649 StackWaitBlock.
Last = &StackWaitBlock;
650 StackWaitBlock.
Wake = 0;
657 First->Last = &StackWaitBlock;
675 StackWaitBlock.
Last = &StackWaitBlock;
676 StackWaitBlock.
Wake = 0;
681 (
PVOID)CurrentValue) == CurrentValue)
717 CurrentValue = *(
volatile LONG_PTR *)&SRWLock->Ptr;
731 if (WaitBlock !=
NULL)
751 (
PVOID)CurrentValue) == CurrentValue)
774 LONG_PTR CompareValue, NewValue, GotValue;
778 CompareValue = *(
volatile LONG_PTR *)&SRWLock->
Ptr;
#define InterlockedExchangePointer(Target, Value)
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
#define InterlockedCompareExchangePointer
typedef __ALIGNED(16) struct _EX_PUSH_LOCK_WAIT_BLOCK
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
#define STATUS_RESOURCE_NOT_OWNED
static VOID NTAPI RtlpReleaseWaitBlockLockLastShared(IN OUT PRTL_SRWLOCK SRWLock, IN PRTLP_SRWLOCK_WAITBLOCK FirstWaitBlock)
struct _RTLP_SRWLOCK_SHARED_WAKE * PRTLP_SRWLOCK_SHARED_WAKE
#define RTL_SRWLOCK_CONTENDED
static VOID NTAPI RtlpAcquireSRWLockSharedWait(IN OUT PRTL_SRWLOCK SRWLock, IN OUT PRTLP_SRWLOCK_WAITBLOCK FirstWait OPTIONAL, IN OUT PRTLP_SRWLOCK_SHARED_WAKE WakeChain)
static VOID NTAPI RtlpReleaseWaitBlockLock(IN OUT PRTL_SRWLOCK SRWLock)
#define RTL_SRWLOCK_CONTENTION_LOCK
static VOID NTAPI RtlpAcquireSRWLockExclusiveWait(IN OUT PRTL_SRWLOCK SRWLock, IN PRTLP_SRWLOCK_WAITBLOCK WaitBlock)
#define RTL_SRWLOCK_SHARED
#define RTL_SRWLOCK_OWNED
#define InterlockedOrPointer(ptr, val)
struct _RTLP_SRWLOCK_WAITBLOCK * PRTLP_SRWLOCK_WAITBLOCK
static VOID NTAPI RtlpReleaseWaitBlockLockExclusive(IN OUT PRTL_SRWLOCK SRWLock, IN PRTLP_SRWLOCK_WAITBLOCK FirstWaitBlock)
VOID NTAPI RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
BOOLEAN NTAPI RtlTryAcquireSRWLockExclusive(PRTL_SRWLOCK SRWLock)
VOID NTAPI RtlInitializeSRWLock(OUT PRTL_SRWLOCK SRWLock)
#define InterlockedBitTestAndSetPointer(ptr, val)
#define RTL_SRWLOCK_OWNED_BIT
VOID NTAPI RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
struct _RTLP_SRWLOCK_SHARED_WAKE RTLP_SRWLOCK_SHARED_WAKE
BOOLEAN NTAPI RtlTryAcquireSRWLockShared(PRTL_SRWLOCK SRWLock)
#define InterlockedAndPointer(ptr, val)
VOID NTAPI RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
VOID NTAPI RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
struct _RTLP_SRWLOCK_WAITBLOCK RTLP_SRWLOCK_WAITBLOCK
static PRTLP_SRWLOCK_WAITBLOCK NTAPI RtlpAcquireWaitBlockLock(IN OUT PRTL_SRWLOCK SRWLock)
PULONG MinorVersion OPTIONAL
volatile struct _RTLP_SRWLOCK_SHARED_WAKE * Next
volatile struct _RTLP_SRWLOCK_WAITBLOCK * Last
PRTLP_SRWLOCK_SHARED_WAKE SharedWakeChain
volatile struct _RTLP_SRWLOCK_WAITBLOCK * Next
PRTLP_SRWLOCK_SHARED_WAKE LastSharedWake