From 3b4795b46fa190ea29007a6b9766689cacffe3d2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 14 Feb 2020 11:20:42 +0100 Subject: config: Remove CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_* configuration options. These two options are probably unused, see also: * https://lists.rtems.org/pipermail/users/2019-April/033129.html * https://lists.rtems.org/pipermail/users/2019-April/033130.html Removing them simplifies the configuration. If there is a real user need which shows up after the removal, we can resurrect them on demand. Using CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE would have required the use of the undocumented CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME and CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE configuration options. Update #3874. --- cpukit/posix/src/pthreadinitthreads.c | 75 +++++++++++++++-------------------- 1 file changed, 31 insertions(+), 44 deletions(-) (limited to 'cpukit/posix/src/pthreadinitthreads.c') diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 89163f43ab..3adaa8b7ab 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -18,33 +18,22 @@ #include "config.h" #endif -#include +#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include -void _POSIX_Threads_Initialize_user_threads_body(void) +void _POSIX_Threads_Initialize_user_thread( void ) { - int eno; - uint32_t index; - uint32_t maximum; - posix_initialization_threads_table *user_threads; - pthread_t thread_id; - pthread_attr_t attr; - - user_threads = _Configuration_POSIX_Initialization_threads; - maximum = _Configuration_POSIX_Initialization_thread_count; + int eno; + const posix_initialization_threads_table *user_thread; + pthread_t thread_id; + pthread_attr_t attr; - if ( !user_threads ) - return; + user_thread = &_POSIX_Threads_User_thread_table; /* * Be careful .. if the default attribute set changes, this may need to. @@ -53,29 +42,27 @@ void _POSIX_Threads_Initialize_user_threads_body(void) * to inherit the idle tasks attributes. */ - for ( index=0 ; index < maximum ; index++ ) { - /* - * There is no way for these calls to fail in this situation. - */ - eno = pthread_attr_init( &attr ); - _Assert( eno == 0 ); - eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); - _Assert( eno == 0 ); - eno = pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size); - _Assert( eno == 0 ); + /* + * There is no way for these calls to fail in this situation. + */ + eno = pthread_attr_init( &attr ); + _Assert( eno == 0 ); + eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); + _Assert( eno == 0 ); + eno = pthread_attr_setstacksize( &attr, user_thread->stack_size ); + _Assert( eno == 0 ); - eno = pthread_create( - &thread_id, - &attr, - user_threads[ index ].thread_entry, - NULL - ); - if ( eno != 0 ) { - _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED ); - } + eno = pthread_create( + &thread_id, + &attr, + user_thread->thread_entry, + NULL + ); + if ( eno != 0 ) { + _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED ); + } - if ( _Thread_Global_constructor == 0 ) { - _Thread_Global_constructor = thread_id; - } + if ( _Thread_Global_constructor == 0 ) { + _Thread_Global_constructor = thread_id; } } -- cgit v1.2.3