[ros-diffs] [tkreuzer] 53207: [WIN32K] Simplify the loop to remove the THREADINFO from the PROCESSINFO's list when cleaning up
tkreuzer at svn.reactos.org
tkreuzer at svn.reactos.org
Sat Aug 13 16:44:50 UTC 2011
Author: tkreuzer
Date: Sat Aug 13 16:44:49 2011
New Revision: 53207
URL: http://svn.reactos.org/svn/reactos?rev=53207&view=rev
Log:
[WIN32K]
Simplify the loop to remove the THREADINFO from the PROCESSINFO's list when cleaning up
Modified:
trunk/reactos/subsystems/win32/win32k/main/dllmain.c
Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/main/dllmain.c?rev=53207&r1=53206&r2=53207&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Sat Aug 13 16:44:49 2011
@@ -368,32 +368,28 @@
}
else
{
- PTHREADINFO pti;
+ PTHREADINFO *ppti;
PSINGLE_LIST_ENTRY psle;
+ PPROCESSINFO ppiCurrent;
DPRINT("Destroying W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql());
+ ppiCurrent = ptiCurrent->ppi;
ptiCurrent->TIF_flags |= TIF_INCLEANUP;
- pti = ptiCurrent->ppi->ptiList;
- if (pti == ptiCurrent)
- {
- ptiCurrent->ppi->ptiList = ptiCurrent->ptiSibling;
- ptiCurrent->ppi->cThreads--;
- }
- else
- {
- do
- {
- if (pti->ptiSibling == ptiCurrent)
- {
- pti->ptiSibling = ptiCurrent->ptiSibling;
- ptiCurrent->ppi->cThreads--;
- break;
- }
- pti = pti->ptiSibling;
- }
- while (pti);
- }
+
+ /* Find the THREADINFO in the PROCESSINFO's list */
+ ppti = &ppiCurrent->ptiList;
+ while (*ppti != NULL && *ppti != ptiCurrent)
+ {
+ ppti = &((*ppti)->ptiSibling);
+ }
+
+ /* we must have found it */
+ ASSERT(*ppti == ptiCurrent);
+
+ /* Remove it from the list */
+ *ppti = ptiCurrent->ptiSibling;
+
DceFreeThreadDCE(ptiCurrent);
HOOK_DestroyThreadHooks(Thread);
EVENT_DestroyThreadEvents(Thread);
@@ -421,6 +417,9 @@
}
IntSetThreadDesktop(NULL, TRUE);
+
+ /* Decrement thread count */
+ ppiCurrent->cThreads--;
PsSetThreadWin32Thread(Thread, NULL);
}
More information about the Ros-diffs
mailing list