[RFC PATCH 04/11] ntdll: Add thread destroy notification function.

Rémi Bernon rbernon at codeweavers.com
Wed May 6 07:09:56 CDT 2020


This will be used in LFH to recycle the thread local data.
---
 dlls/ntdll/heap.c       | 4 ++++
 dlls/ntdll/loader.c     | 1 +
 dlls/ntdll/ntdll_misc.h | 2 ++
 dlls/ntdll/thread.c     | 1 +
 4 files changed, 8 insertions(+)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index ac0a1c800163..2d6c8e0ca19f 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -2293,3 +2293,7 @@ NTSTATUS WINAPI RtlSetHeapInformation( HANDLE heap, HEAP_INFORMATION_CLASS info_
     FIXME("%p %d %p %ld stub\n", heap, info_class, info, size);
     return STATUS_SUCCESS;
 }
+
+void HEAP_notify_thread_destroy( BOOLEAN last )
+{
+}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index b5091e2b5627..a5b86f289f47 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3730,6 +3730,7 @@ void WINAPI RtlExitUserProcess( DWORD status )
     RtlAcquirePebLock();
     NtTerminateProcess( 0, status );
     LdrShutdownProcess();
+    HEAP_notify_thread_destroy(TRUE);
     NtTerminateProcess( GetCurrentProcess(), status );
     exit( get_unix_exit_code( status ));
 }
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index fc78a24dc9d3..3369eb980a5f 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -290,6 +290,8 @@ void   *HEAP_std_reallocate( struct tagHEAP *heap, ULONG flags, void *ptr, SIZE_
 SIZE_T  HEAP_std_get_allocated_size( struct tagHEAP *heap, ULONG flags, const void *ptr );
 BOOLEAN HEAP_std_validate( struct tagHEAP *heap, ULONG flags, const void *ptr );
 
+void HEAP_notify_thread_destroy( BOOLEAN last );
+
 extern mode_t FILE_umask DECLSPEC_HIDDEN;
 extern HANDLE keyed_event DECLSPEC_HIDDEN;
 extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index b25f87e43755..f223ca9fb5f9 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -358,6 +358,7 @@ void WINAPI RtlExitUserThread( ULONG status )
 
     LdrShutdownThread();
     RtlFreeThreadActivationContextStack();
+    HEAP_notify_thread_destroy(FALSE);
 
     pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
 
-- 
2.26.1




More information about the wine-devel mailing list