/* Set the Thread to initalized */
Thread->State = Initialized;
- /* Insert the Thread into the Process's Thread List */
+ /*
+ * Insert the Thread into the Process's Thread List
+ * Note, this is the KTHREAD Thread List. It is removed in
+ * ke/kthread.c!KeTerminateThread.
+ */
InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
DPRINT("Thread initalized\n");
}
/* Lock the Dispatcher Database and the APC Queue */
DPRINT("Terminating\n");
OldIrql = KeAcquireDispatcherDatabaseLock();
+
+ /* Remove the thread from the list */
+ RemoveEntryList(&Thread->ThreadListEntry);
/* Insert into the Reaper List */
DPRINT("List: %p\n", PspReaperList);