mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 11:33:38 +00:00
ntdll: Move freeing the thread stack to a common helper.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6f790606c0
commit
93eceba03e
|
@ -944,14 +944,8 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
*/
|
||||
void signal_free_thread( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
SIZE_T size = 0;
|
||||
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
|
||||
|
|
|
@ -817,14 +817,8 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
*/
|
||||
void signal_free_thread( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
SIZE_T size = 0;
|
||||
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
|
||||
|
|
|
@ -2504,16 +2504,10 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
*/
|
||||
void signal_free_thread( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
SIZE_T size = 0;
|
||||
struct x86_thread_data *thread_data = (struct x86_thread_data *)teb->SystemReserved2;
|
||||
|
||||
if (thread_data) wine_ldt_free_fs( thread_data->fs );
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
size = 0;
|
||||
wine_ldt_free_fs( thread_data->fs );
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
|
||||
|
|
|
@ -1023,14 +1023,8 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
*/
|
||||
void signal_free_thread( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
SIZE_T size = 0;
|
||||
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
|
||||
|
|
|
@ -2983,14 +2983,8 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
*/
|
||||
void signal_free_thread( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
SIZE_T size = 0;
|
||||
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
|
||||
|
|
|
@ -403,6 +403,22 @@ HANDLE thread_init(void)
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* free_thread_data
|
||||
*/
|
||||
static void free_thread_data( TEB *teb )
|
||||
{
|
||||
SIZE_T size;
|
||||
|
||||
if (teb->DeallocationStack)
|
||||
{
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
|
||||
}
|
||||
signal_free_thread( teb );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* terminate_thread
|
||||
*/
|
||||
|
@ -456,7 +472,7 @@ void exit_thread( int status )
|
|||
if (thread_data->pthread_id)
|
||||
{
|
||||
pthread_join( thread_data->pthread_id, NULL );
|
||||
signal_free_thread( teb );
|
||||
free_thread_data( teb );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,7 +650,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
|
|||
return STATUS_SUCCESS;
|
||||
|
||||
error:
|
||||
if (teb) signal_free_thread( teb );
|
||||
if (teb) free_thread_data( teb );
|
||||
if (handle) NtClose( handle );
|
||||
pthread_sigmask( SIG_SETMASK, &sigset, NULL );
|
||||
close( request_pipe[1] );
|
||||
|
|
Loading…
Reference in a new issue