mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHSVCS] Don't call UnregisterWait from within the wait callback.
Doing this causes deadlocks, the process runs out of worker threads and the system runs out of memory by allocating too many I/O completion ports when using ntdll.dll from Windows.
This commit is contained in:
parent
c58d7a6df6
commit
5a5ba1ad10
1 changed files with 7 additions and 7 deletions
|
@ -76,7 +76,6 @@ CALLBACK
|
|||
ThemeStopCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
||||
{
|
||||
CloseHandle(hServiceProcess);
|
||||
UnregisterWait(hThemeStopWaitObject);
|
||||
UnregisterWait(hThemeServiceWaitObject);
|
||||
|
||||
ThemeWatchForStart();
|
||||
|
@ -92,7 +91,10 @@ ThemeServiceDiedCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
|||
ResetEvent(hStartEvent);
|
||||
ResetEvent(hStopEvent);
|
||||
|
||||
ThemeStopCallback(lpParameter, TimerOrWaitFired);
|
||||
CloseHandle(hServiceProcess);
|
||||
UnregisterWait(hThemeStopWaitObject);
|
||||
ThemeWatchForStart();
|
||||
ThemeHooksRemove();
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -100,12 +102,10 @@ VOID
|
|||
CALLBACK
|
||||
ThemeStartCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
||||
{
|
||||
UnregisterWait(hThemeStartWaitObject);
|
||||
|
||||
hServiceProcess = GetThemeServiceProcessHandle();
|
||||
|
||||
RegisterWaitForSingleObject(&hThemeStopWaitObject, hStopEvent, ThemeStopCallback, NULL, INFINITE, WT_EXECUTEDEFAULT);
|
||||
RegisterWaitForSingleObject(&hThemeServiceWaitObject, hServiceProcess, ThemeServiceDiedCallback, NULL, INFINITE, WT_EXECUTEDEFAULT);
|
||||
RegisterWaitForSingleObject(&hThemeStopWaitObject, hStopEvent, ThemeStopCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||
RegisterWaitForSingleObject(&hThemeServiceWaitObject, hServiceProcess, ThemeServiceDiedCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||
|
||||
ThemeHooksInstall();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ ThemeWatchForStart(VOID)
|
|||
hStartEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStartEvent");
|
||||
hStopEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStopEvent");
|
||||
|
||||
RegisterWaitForSingleObject(&hThemeStartWaitObject, hStartEvent, ThemeStartCallback, NULL, INFINITE, WT_EXECUTEDEFAULT);
|
||||
RegisterWaitForSingleObject(&hThemeStartWaitObject, hStartEvent, ThemeStartCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue