https://git.reactos.org/?p=reactos.git;a=commitdiff;h=043a98ddd9969ceebf5068...
commit 043a98ddd9969ceebf50682e296565dc11f25fc0 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sat Dec 15 15:26:01 2018 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sat Dec 15 20:19:32 2018 +0100
[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). --- base/services/umpnpmgr/umpnpmgr.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/base/services/umpnpmgr/umpnpmgr.c b/base/services/umpnpmgr/umpnpmgr.c index e34b5c49ea..e1b0e1f276 100644 --- a/base/services/umpnpmgr/umpnpmgr.c +++ b/base/services/umpnpmgr/umpnpmgr.c @@ -28,7 +28,6 @@
/* INCLUDES *****************************************************************/
-//#define HAVE_SLIST_ENTRY_IMPLEMENTED #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H @@ -69,20 +68,12 @@ static HANDLE hUserToken = NULL; static HANDLE hInstallEvent = NULL; static HANDLE hNoPendingInstalls = NULL;
-#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED static SLIST_HEADER DeviceInstallListHead; -#else -static LIST_ENTRY DeviceInstallListHead; -#endif static HANDLE hDeviceInstallListNotEmpty;
typedef struct { -#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED SLIST_ENTRY ListEntry; -#else - LIST_ENTRY ListEntry; -#endif WCHAR DeviceIds[1]; } DeviceInstallParams;
@@ -3461,11 +3452,7 @@ cleanup: static DWORD WINAPI DeviceInstallThread(LPVOID lpParameter) { -#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED PSLIST_ENTRY ListEntry; -#else - PLIST_ENTRY ListEntry; -#endif DeviceInstallParams* Params; BOOL showWizard;
@@ -3477,14 +3464,8 @@ DeviceInstallThread(LPVOID lpParameter)
while (TRUE) { -#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED ListEntry = InterlockedPopEntrySList(&DeviceInstallListHead); -#else - if ((BOOL)IsListEmpty(&DeviceInstallListHead)) - ListEntry = NULL; - else - ListEntry = RemoveHeadList(&DeviceInstallListHead); -#endif + if (ListEntry == NULL) { SetEvent(hNoPendingInstalls); @@ -3560,11 +3541,7 @@ PnpEventThread(LPVOID lpParameter) if (Params) { wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds); -#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED InterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry); -#else - InsertTailList(&DeviceInstallListHead, &Params->ListEntry); -#endif SetEvent(hDeviceInstallListNotEmpty); } } @@ -3808,11 +3785,7 @@ InitializePnPManager(VOID) return dwError; }
-#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED InitializeSListHead(&DeviceInstallListHead); -#else - InitializeListHead(&DeviceInstallListHead); -#endif
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"System\CurrentControlSet\Enum",