23#define COND_VAR_UNUSED_FLAG ((ULONG_PTR)1)
24#define COND_VAR_LOCKED_FLAG ((ULONG_PTR)2)
25#define COND_VAR_FLAGS_MASK ((ULONG_PTR)3)
26#define COND_VAR_ADDRESS_MASK (~COND_VAR_FLAGS_MASK)
37#define CONTAINING_COND_VAR_WAIT_ENTRY(address, field) \
38 CONTAINING_RECORD(address, COND_VAR_WAIT_ENTRY, field)
113 if ((AbortIfLocked !=
NULL) && *AbortIfLocked)
120 OldVal = *(
ULONG_PTR *)&ConditionVariable->Ptr;
127 if (InsertEntry ==
NULL)
130 if (OldListHead ==
NULL)
152 if (LockRes == OldVal)
156 if (InsertEntry ==
NULL)
166 if (OldListHead ==
NULL)
204 if (RemoveEntry !=
NULL)
207 if (&RemoveEntry->ListEntry == NewHeadEntry)
215 NewHeadEntry = NewHeadEntry->Flink;
236 RemoveEntry->ListRemovalHandled =
TRUE;
246 if (LockRes == OldVal)
273 if (HeadEntry ==
NULL)
281 RemoveOnUnlockEntry =
NULL;
292 if (HeadEntry ==
Entry)
321 if (HeadEntry ==
Entry)
326 RemoveOnUnlockEntry = HeadEntry;
481 ConditionVariable->Ptr =
NULL;
static VOID InternalWake(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN BOOLEAN ReleaseAll)
static VOID InternalUnlockCondVar(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN PCOND_VAR_WAIT_ENTRY RemoveEntry OPTIONAL)
#define COND_VAR_FLAGS_MASK
NTSTATUS NTAPI RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN OUT PRTL_SRWLOCK SRWLock, IN PLARGE_INTEGER TimeOut OPTIONAL, IN ULONG Flags)
NTSTATUS NTAPI RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN OUT PRTL_CRITICAL_SECTION CriticalSection, IN PLARGE_INTEGER TimeOut OPTIONAL)
FORCEINLINE ULONG_PTR InternalCmpXChgCondVarAcq(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN ULONG_PTR Exchange, IN ULONG_PTR Comperand)
FORCEINLINE ULONG_PTR InternalCmpXChgCondVarRel(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN ULONG_PTR Exchange, IN ULONG_PTR Comperand)
static NTSTATUS InternalSleep(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN OUT PRTL_CRITICAL_SECTION CriticalSection OPTIONAL, IN OUT PRTL_SRWLOCK SRWLock OPTIONAL, IN ULONG SRWFlags, IN const LARGE_INTEGER *TimeOut OPTIONAL)
VOID NTAPI RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
VOID NTAPI RtlInitializeConditionVariable(OUT PRTL_CONDITION_VARIABLE ConditionVariable)
static HANDLE CondVarKeyedEventHandle
struct _COND_VAR_WAIT_ENTRY COND_VAR_WAIT_ENTRY
#define COND_VAR_ADDRESS_MASK
#define CONTAINING_COND_VAR_WAIT_ENTRY(address, field)
VOID NTAPI RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
VOID NTAPI RtlWakeAllConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable)
#define COND_VAR_LOCKED_FLAG
static PCOND_VAR_WAIT_ENTRY InternalLockCondVar(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, IN PCOND_VAR_WAIT_ENTRY InsertEntry OPTIONAL, IN BOOLEAN *AbortIfLocked OPTIONAL)
VOID NTAPI RtlpCloseKeyedEvent(VOID)
VOID NTAPI RtlWakeConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable)
VOID NTAPI RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
VOID NTAPI RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
FORCEINLINE BOOLEAN * InternalGetListRemovalHandledFlag(IN PCOND_VAR_WAIT_ENTRY Entry)
VOID NTAPI RtlpInitializeKeyedEvent(VOID)
struct _COND_VAR_WAIT_ENTRY * PCOND_VAR_WAIT_ENTRY
#define NT_SUCCESS(StatCode)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define InitializeListHead(ListHead)
NTSYSAPI NTSTATUS WINAPI NtCreateKeyedEvent(HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, ULONG)
NTSYSAPI NTSTATUS WINAPI NtWaitForKeyedEvent(HANDLE, const void *, BOOLEAN, const LARGE_INTEGER *)
NTSYSAPI NTSTATUS WINAPI NtReleaseKeyedEvent(HANDLE, const void *, BOOLEAN, const LARGE_INTEGER *)
#define InterlockedCompareExchangePointerRelease
#define InterlockedCompareExchangePointerAcquire
CRITICAL_SECTION CriticalSection
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define STATUS_INVALID_HANDLE
PULONG MinorVersion OPTIONAL
base of all file and directory entries
BOOLEAN ListRemovalHandled
struct _LIST_ENTRY * PLIST_ENTRY
#define RtlZeroMemory(Destination, Length)
_Must_inspect_result_ _In_ ULONG Flags
#define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED