16 DLinkListEx::DLinkListEx(
DWORD SpinCount )
20 InitializeCriticalSectionAndSpinCount( &_csect, SpinCount );
28 InitializeCriticalSectionAndSpinCount( &_csect, SpinCount );
31 _grabList( ListHead );
36 DLinkListEx::~DLinkListEx()
39 DeleteCriticalSection( &_csect );
42 bool DLinkListEx::Lock(
bool Wait )
47 ok =
bool_cast( TryEnterCriticalSection( &_csect ));
48 if (!ok) SetLastError( ERROR_LOCK_FAILED );
56 EnterCriticalSection( &_csect );
62 void DLinkListEx::Unlock()
64 LeaveCriticalSection( &_csect );
67 DWORD DLinkListEx::SetLockSpinCount(
DWORD SpinCount )
69 return SetCriticalSectionSpinCount( &_csect, SpinCount );
76 UINT DLinkListEx::ExportToListHead(
PLIST_ENTRY ListHead )
98 UINT DLinkListEx::ExportToHeadlessList(
PLIST_ENTRY* Target )
126 if (!Lock(
true )) Entry = NULL;
137 if (!Lock(
true )) Entry = NULL;
161 UINT nrAdded = DLinkListEx::AppendList( (
PLIST_ENTRY)ListToAppend, ppFirst );
162 if (nrAdded) ListToAppend->Count = 0;
168 if (!Lock(
true )) Entry = NULL;
177 void DLinkListEx::RemoveAll(
PDListFunc ItemAction,
void* UserData )
194 void DLinkListEx::QuickSort(
PDListComp Compare,
void* Context )
210 bool locked = Lock();
223 bool locked = Lock();
233 bool DLinkListEx::ForEach(
PDListFunc Action,
void* UserData )
235 bool complete =
false;
236 bool locked = Lock();
PLIST_ENTRY FirstThat(PDListFunc Match, void *UserData=NULL)
UINT ExportToListHead(PLIST_ENTRY ListHead)
UINT ImportFromListHead(IN PLIST_ENTRY ListHead, OPTOUT PLIST_ENTRY *ppFirst)
PLIST_ENTRY LastThat(PDListFunc Match, void *UserData=NULL)
UINT ImportHeadlessList(IN PLIST_ENTRY Circular, OPTOUT PLIST_ENTRY *ppFirst)
bool ForEach(PDListFunc Action, void *UserData=NULL)
UINT AppendList(IN PLIST_ENTRY ListToAppend, OPTOUT PLIST_ENTRY *ppFirst)
struct _LIST_ENTRY * PLIST_ENTRY
bool(__stdcall * PDListFunc)(PLIST_ENTRY Entry, void *UserData)
PLIST_ENTRY Prepend(PLIST_ENTRY Entry)
#define TRACE_IF(cond,...)
PLIST_ENTRY Append(PLIST_ENTRY Entry)
int(__stdcall * PDListComp)(PLIST_ENTRY X, PLIST_ENTRY Y, void *UserData)
void QuickSort(PDListComp Compare, void *UserData=NULL)
bool __forceinline bool_cast(BOOL B52)
void RemoveAll(PDListFunc ItemAction, void *UserData=NULL)
Debug and error handling support.
class DLinkList * PDLinkList
UINT ExportToHeadlessList(PLIST_ENTRY *Circular)
PLIST_ENTRY RemoveEntry(PLIST_ENTRY Entry)