From a7dcef97e93240b1947a0094b1af91e9b9324a30 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 17 Nov 2017 06:36:54 +0100 Subject: score: Simplify global construction Update #3243. --- cpukit/posix/src/pthreadinitthreads.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 7695879aae..1777ec9b6d 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -31,19 +31,6 @@ #include #include #include -#include - -static void *_POSIX_Global_construction( void *arg ) -{ - Thread_Control *executing = _Thread_Get_executing(); - Thread_Entry_information entry = executing->Start.Entry; - - entry.Kinds.Pointer.entry = Configuration_POSIX_API - .User_initialization_threads_table[ 0 ].thread_entry; - - (void) arg; - _Thread_Global_construction( executing, &entry ); -} void _POSIX_Threads_Initialize_user_threads_body(void) { @@ -53,7 +40,6 @@ void _POSIX_Threads_Initialize_user_threads_body(void) posix_initialization_threads_table *user_threads; pthread_t thread_id; pthread_attr_t attr; - bool register_global_construction; void *(*thread_entry)(void *); user_threads = Configuration_POSIX_API.User_initialization_threads_table; @@ -62,9 +48,6 @@ void _POSIX_Threads_Initialize_user_threads_body(void) if ( !user_threads ) return; - register_global_construction = - Configuration_RTEMS_API.number_of_initialization_tasks == 0; - /* * Be careful .. if the default attribute set changes, this may need to. * @@ -88,11 +71,6 @@ void _POSIX_Threads_Initialize_user_threads_body(void) _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL ); } - if ( register_global_construction ) { - register_global_construction = false; - thread_entry = _POSIX_Global_construction; - } - eno = pthread_create( &thread_id, &attr, @@ -102,5 +80,9 @@ void _POSIX_Threads_Initialize_user_threads_body(void) if ( eno != 0 ) { _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED ); } + + if ( _Thread_Global_constructor == 0 ) { + _Thread_Global_constructor = thread_id; + } } } -- cgit v1.2.3