mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
Still not done...
svn path=/trunk/; revision=7321
This commit is contained in:
parent
c8f27683f0
commit
d8575f7b6a
1 changed files with 29 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: thread.c,v 1.46 2003/12/30 00:12:47 hyperion Exp $
|
/* $Id: thread.c,v 1.47 2003/12/30 01:08:16 hyperion Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -281,6 +281,27 @@ GetCurrentThreadId(VOID)
|
||||||
return((DWORD)(NtCurrentTeb()->Cid).UniqueThread);
|
return((DWORD)(NtCurrentTeb()->Cid).UniqueThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID FASTCALL K32FreeCurrentStack(VOID)
|
||||||
|
{
|
||||||
|
MEMORY_BASIC_INFORMATION mbiInfo;
|
||||||
|
|
||||||
|
if(VirtualQuery(NtCurrentTeb()->Tib.StackLimit, &mbiInfo, sizeof(mbiInfo)))
|
||||||
|
VirtualFree(mbiInfo.AllocationBase, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(noreturn) VOID STDCALL K32ExitThread(DWORD nExitCode)
|
||||||
|
{
|
||||||
|
K32FreeCurrentStack();
|
||||||
|
NtTerminateThread(NtCurrentThread(), nExitCode);
|
||||||
|
for(;;);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern __declspec(noreturn) VOID STDCALL K32SwitchStackAndExitThread
|
||||||
|
(
|
||||||
|
PVOID pStackBase,
|
||||||
|
SIZE_T uStackSize,
|
||||||
|
DWORD uExitCode
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -288,8 +309,8 @@ GetCurrentThreadId(VOID)
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
ExitThread(DWORD uExitCode)
|
ExitThread(DWORD uExitCode)
|
||||||
{
|
{
|
||||||
BOOLEAN LastThread;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
BOOLEAN LastThread;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Terminate process if this is the last thread
|
* Terminate process if this is the last thread
|
||||||
|
@ -309,13 +330,12 @@ ExitThread(DWORD uExitCode)
|
||||||
|
|
||||||
LdrShutdownThread();
|
LdrShutdownThread();
|
||||||
|
|
||||||
Status = NtTerminateThread(NtCurrentThread(),
|
K32SwitchStackAndExitThread
|
||||||
uExitCode);
|
(
|
||||||
if (!NT_SUCCESS(Status))
|
NtCurrentTeb()->StaticUnicodeBuffer,
|
||||||
{
|
sizeof(NtCurrentTeb()->StaticUnicodeBuffer),
|
||||||
SetLastErrorByStatus(Status);
|
uExitCode
|
||||||
}
|
);
|
||||||
for(;;); /* GCC complains noreturn function should not return */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue