-/* $Id: kill.c,v 1.86 2004/11/21 18:42:58 gdalsnes Exp $
+/* $Id: kill.c,v 1.87 2004/11/27 16:47:05 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
(ULONG) CurrentThread);
}
+ KeCancelTimer(&CurrentThread->Tcb.Timer);
+
KeAcquireSpinLock(&PiThreadLock, &oldIrql);
DPRINT("terminating %x\n",CurrentThread);
CurrentThread->HasTerminated = TRUE;
CurrentThread->ExitStatus = ExitStatus;
KeQuerySystemTime((PLARGE_INTEGER)&CurrentThread->ExitTime);
- KeCancelTimer(&CurrentThread->Tcb.Timer);
/* If the ProcessoR Control Block's NpxThread points to the current thread
* unset it.
MmReleaseMemoryAreaIfDecommitted(CurrentProcess, &CurrentProcess->AddressSpace, TebBlock);
MmUnlockAddressSpace(&CurrentProcess->AddressSpace);
}
+ CurrentThread->Tcb.Teb = NULL;
ExReleaseFastMutex(&CurrentProcess->TebLock);
}
DPRINT("PsTerminateOtherThread(Thread %x, ExitStatus %x)\n",
Thread, ExitStatus);
-
+
+ KeAcquireSpinLock(&PiThreadLock, &OldIrql);
+ if (Thread->HasTerminated)
+ {
+ KeReleaseSpinLock(&PiThreadLock, OldIrql);
+ return;
+ }
Thread->HasTerminated = TRUE;
+ KeReleaseSpinLock(&PiThreadLock, OldIrql);
Thread->ExitStatus = ExitStatus;
Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
KeInitializeApc(Apc,