mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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)
|
ThemeStopCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
||||||
{
|
{
|
||||||
CloseHandle(hServiceProcess);
|
CloseHandle(hServiceProcess);
|
||||||
UnregisterWait(hThemeStopWaitObject);
|
|
||||||
UnregisterWait(hThemeServiceWaitObject);
|
UnregisterWait(hThemeServiceWaitObject);
|
||||||
|
|
||||||
ThemeWatchForStart();
|
ThemeWatchForStart();
|
||||||
|
@ -92,7 +91,10 @@ ThemeServiceDiedCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
||||||
ResetEvent(hStartEvent);
|
ResetEvent(hStartEvent);
|
||||||
ResetEvent(hStopEvent);
|
ResetEvent(hStopEvent);
|
||||||
|
|
||||||
ThemeStopCallback(lpParameter, TimerOrWaitFired);
|
CloseHandle(hServiceProcess);
|
||||||
|
UnregisterWait(hThemeStopWaitObject);
|
||||||
|
ThemeWatchForStart();
|
||||||
|
ThemeHooksRemove();
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -100,12 +102,10 @@ VOID
|
||||||
CALLBACK
|
CALLBACK
|
||||||
ThemeStartCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
ThemeStartCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
|
||||||
{
|
{
|
||||||
UnregisterWait(hThemeStartWaitObject);
|
|
||||||
|
|
||||||
hServiceProcess = GetThemeServiceProcessHandle();
|
hServiceProcess = GetThemeServiceProcessHandle();
|
||||||
|
|
||||||
RegisterWaitForSingleObject(&hThemeStopWaitObject, hStopEvent, ThemeStopCallback, NULL, INFINITE, WT_EXECUTEDEFAULT);
|
RegisterWaitForSingleObject(&hThemeStopWaitObject, hStopEvent, ThemeStopCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||||
RegisterWaitForSingleObject(&hThemeServiceWaitObject, hServiceProcess, ThemeServiceDiedCallback, NULL, INFINITE, WT_EXECUTEDEFAULT);
|
RegisterWaitForSingleObject(&hThemeServiceWaitObject, hServiceProcess, ThemeServiceDiedCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||||
|
|
||||||
ThemeHooksInstall();
|
ThemeHooksInstall();
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ ThemeWatchForStart(VOID)
|
||||||
hStartEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStartEvent");
|
hStartEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStartEvent");
|
||||||
hStopEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStopEvent");
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue