mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
- Prevent from terminate a thread for twice.
- Don't call KeCancelTimer for the thread timer if the thread lock is held. svn path=/trunk/; revision=11839
This commit is contained in:
parent
be30cb2cf0
commit
6c0c99c180
1 changed files with 12 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $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
|
||||
|
@ -129,6 +129,8 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
|||
(ULONG) CurrentThread);
|
||||
}
|
||||
|
||||
KeCancelTimer(&CurrentThread->Tcb.Timer);
|
||||
|
||||
KeAcquireSpinLock(&PiThreadLock, &oldIrql);
|
||||
|
||||
DPRINT("terminating %x\n",CurrentThread);
|
||||
|
@ -136,7 +138,6 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
|||
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.
|
||||
|
@ -175,6 +176,7 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
|||
MmReleaseMemoryAreaIfDecommitted(CurrentProcess, &CurrentProcess->AddressSpace, TebBlock);
|
||||
MmUnlockAddressSpace(&CurrentProcess->AddressSpace);
|
||||
}
|
||||
CurrentThread->Tcb.Teb = NULL;
|
||||
ExReleaseFastMutex(&CurrentProcess->TebLock);
|
||||
}
|
||||
|
||||
|
@ -257,8 +259,15 @@ PsTerminateOtherThread(PETHREAD Thread,
|
|||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue