From cf4ca4e24e3480879b813d65ad2ed5f0c8a08cdf Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 12 Oct 2003 02:26:20 +0000 Subject: [PATCH] Moved the errno functions patching to wine_pthread_init_thread so that it's done early enough now that kernel is only loaded later on. --- scheduler/pthread.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scheduler/pthread.c b/scheduler/pthread.c index 134fe554504..1191b35a05b 100644 --- a/scheduler/pthread.c +++ b/scheduler/pthread.c @@ -157,12 +157,6 @@ void wine_pthread_init_process( const struct wine_pthread_functions *functions ) { memcpy( &funcs, functions, sizeof(funcs) ); funcs.ptr_set_thread_data( &initial_descr ); - initial_descr.cancel_state = PTHREAD_CANCEL_ENABLE; - initial_descr.cancel_type = PTHREAD_CANCEL_ASYNCHRONOUS; - writejump( "__errno_location", __errno_location ); - writejump( "__h_errno_location", __h_errno_location ); - writejump( "__res_state", __res_state ); - if (libc_uselocale) libc_uselocale( -1 /*LC_GLOBAL_LOCALE*/ ); } @@ -173,17 +167,24 @@ void wine_pthread_init_process( const struct wine_pthread_functions *functions ) */ void wine_pthread_init_thread(void) { + struct pthread_descr_struct *descr; + if (funcs.ptr_set_thread_data) { - struct pthread_descr_struct *descr = calloc( 1, sizeof(*descr) ); - + descr = calloc( 1, sizeof(*descr) ); funcs.ptr_set_thread_data( descr ); - descr->cancel_state = PTHREAD_CANCEL_ENABLE; - descr->cancel_type = PTHREAD_CANCEL_ASYNCHRONOUS; if (libc_multiple_threads) *libc_multiple_threads = 1; - if (libc_uselocale) libc_uselocale( -1 /*LC_GLOBAL_LOCALE*/ ); } - /* else it's the first thread, init will be done in wine_pthread_init_process */ + else /* first thread */ + { + descr = &initial_descr; + writejump( "__errno_location", __errno_location ); + writejump( "__h_errno_location", __h_errno_location ); + writejump( "__res_state", __res_state ); + } + descr->cancel_state = PTHREAD_CANCEL_ENABLE; + descr->cancel_type = PTHREAD_CANCEL_ASYNCHRONOUS; + if (libc_uselocale) libc_uselocale( -1 /*LC_GLOBAL_LOCALE*/ ); }