Alexandre Julliard : ntdll: Store the thread startup info in the ntdll_thread_data structure.

Alexandre Julliard julliard at winehq.org
Fri Jul 24 17:05:10 CDT 2020


Module: wine
Branch: master
Commit: e3b059b5bad4b7ff23459a6384c866e3da1bdee1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e3b059b5bad4b7ff23459a6384c866e3da1bdee1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jul 24 11:15:42 2020 +0200

ntdll: Store the thread startup info in the ntdll_thread_data structure.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/thread.c       | 19 ++++---------------
 dlls/ntdll/unix/unix_private.h |  2 ++
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 8ade2d9c78..b2b97e1c57 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -83,13 +83,6 @@ static void pthread_exit_wrapper( int status )
 }
 
 
-/* info passed to a starting thread */
-struct startup_info
-{
-    PRTL_THREAD_START_ROUTINE entry;
-    void                     *arg;
-};
-
 /***********************************************************************
  *           start_thread
  *
@@ -97,7 +90,6 @@ struct startup_info
  */
 static void start_thread( TEB *teb )
 {
-    struct startup_info *info = (struct startup_info *)(teb + 1);
     struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
     struct debug_info debug_info;
     BOOL suspend;
@@ -106,8 +98,8 @@ static void start_thread( TEB *teb )
     thread_data->debug_info = &debug_info;
     thread_data->pthread_id = pthread_self();
     signal_init_thread( teb );
-    server_init_thread( info->entry, &suspend );
-    signal_start_thread( info->entry, info->arg, suspend, pRtlUserThreadStart, teb );
+    server_init_thread( thread_data->start, &suspend );
+    signal_start_thread( thread_data->start, thread_data->param, suspend, pRtlUserThreadStart, teb );
 }
 
 
@@ -152,7 +144,6 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
     data_size_t len;
     struct object_attributes *objattr;
     struct ntdll_thread_data *thread_data;
-    struct startup_info *info;
     DWORD tid = 0;
     int request_pipe[2];
     SIZE_T extra_stack = PTHREAD_STACK_MIN;
@@ -236,10 +227,6 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
     client_id.UniqueThread  = ULongToHandle( tid );
     teb->ClientId = client_id;
 
-    info = (struct startup_info *)(teb + 1);
-    info->entry  = start;
-    info->arg    = param;
-
     teb->Tib.StackBase = stack.StackBase;
     teb->Tib.StackLimit = stack.StackLimit;
     teb->DeallocationStack = stack.DeallocationStack;
@@ -247,6 +234,8 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
     thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
     thread_data->request_fd  = request_pipe[1];
     thread_data->start_stack = (char *)teb->Tib.StackBase;
+    thread_data->start = start;
+    thread_data->param = param;
 
     pthread_attr_init( &pthread_attr );
     pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 0ecc2456ba..af2ad40144 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -60,6 +60,8 @@ struct ntdll_thread_data
     BOOL               wow64_redir;   /* Wow64 filesystem redirection flag */
     pthread_t          pthread_id;    /* pthread thread id */
     struct list        entry;         /* entry in TEB list */
+    PRTL_THREAD_START_ROUTINE start;  /* thread entry point */
+    void              *param;         /* thread entry point parameter */
 };
 
 C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );




More information about the wine-cvs mailing list