mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 14:11:24 +00:00
[UMPNPMGR] Re-enable the usage of Interlocked Singly-Linked lists.
Using locked operations (insertion & removal) on the list of queued
devices installations is necessary, because these operations are done
concurrently by two different threads: PnpEventThread() and
DeviceInstallThread().
Addendum to commit b2aeafca
(r24365).
This commit is contained in:
parent
745fa54506
commit
043a98ddd9
1 changed files with 1 additions and 28 deletions
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
//#define HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
#define _INC_WINDOWS
|
#define _INC_WINDOWS
|
||||||
#define COM_NO_WINDOWS_H
|
#define COM_NO_WINDOWS_H
|
||||||
|
@ -69,20 +68,12 @@ static HANDLE hUserToken = NULL;
|
||||||
static HANDLE hInstallEvent = NULL;
|
static HANDLE hInstallEvent = NULL;
|
||||||
static HANDLE hNoPendingInstalls = NULL;
|
static HANDLE hNoPendingInstalls = NULL;
|
||||||
|
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
static SLIST_HEADER DeviceInstallListHead;
|
static SLIST_HEADER DeviceInstallListHead;
|
||||||
#else
|
|
||||||
static LIST_ENTRY DeviceInstallListHead;
|
|
||||||
#endif
|
|
||||||
static HANDLE hDeviceInstallListNotEmpty;
|
static HANDLE hDeviceInstallListNotEmpty;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
SLIST_ENTRY ListEntry;
|
SLIST_ENTRY ListEntry;
|
||||||
#else
|
|
||||||
LIST_ENTRY ListEntry;
|
|
||||||
#endif
|
|
||||||
WCHAR DeviceIds[1];
|
WCHAR DeviceIds[1];
|
||||||
} DeviceInstallParams;
|
} DeviceInstallParams;
|
||||||
|
|
||||||
|
@ -3461,11 +3452,7 @@ cleanup:
|
||||||
static DWORD WINAPI
|
static DWORD WINAPI
|
||||||
DeviceInstallThread(LPVOID lpParameter)
|
DeviceInstallThread(LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
PSLIST_ENTRY ListEntry;
|
PSLIST_ENTRY ListEntry;
|
||||||
#else
|
|
||||||
PLIST_ENTRY ListEntry;
|
|
||||||
#endif
|
|
||||||
DeviceInstallParams* Params;
|
DeviceInstallParams* Params;
|
||||||
BOOL showWizard;
|
BOOL showWizard;
|
||||||
|
|
||||||
|
@ -3477,14 +3464,8 @@ DeviceInstallThread(LPVOID lpParameter)
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
ListEntry = InterlockedPopEntrySList(&DeviceInstallListHead);
|
ListEntry = InterlockedPopEntrySList(&DeviceInstallListHead);
|
||||||
#else
|
|
||||||
if ((BOOL)IsListEmpty(&DeviceInstallListHead))
|
|
||||||
ListEntry = NULL;
|
|
||||||
else
|
|
||||||
ListEntry = RemoveHeadList(&DeviceInstallListHead);
|
|
||||||
#endif
|
|
||||||
if (ListEntry == NULL)
|
if (ListEntry == NULL)
|
||||||
{
|
{
|
||||||
SetEvent(hNoPendingInstalls);
|
SetEvent(hNoPendingInstalls);
|
||||||
|
@ -3560,11 +3541,7 @@ PnpEventThread(LPVOID lpParameter)
|
||||||
if (Params)
|
if (Params)
|
||||||
{
|
{
|
||||||
wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds);
|
wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds);
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
InterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry);
|
InterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry);
|
||||||
#else
|
|
||||||
InsertTailList(&DeviceInstallListHead, &Params->ListEntry);
|
|
||||||
#endif
|
|
||||||
SetEvent(hDeviceInstallListNotEmpty);
|
SetEvent(hDeviceInstallListNotEmpty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3808,11 +3785,7 @@ InitializePnPManager(VOID)
|
||||||
return dwError;
|
return dwError;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
|
|
||||||
InitializeSListHead(&DeviceInstallListHead);
|
InitializeSListHead(&DeviceInstallListHead);
|
||||||
#else
|
|
||||||
InitializeListHead(&DeviceInstallListHead);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"System\\CurrentControlSet\\Enum",
|
L"System\\CurrentControlSet\\Enum",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue