summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadinitthreads.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-14 11:20:42 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-25 07:15:18 +0100
commit3b4795b46fa190ea29007a6b9766689cacffe3d2 (patch)
tree0a1bb8cc582370c2469805d580eb0c230a832289 /cpukit/posix/src/pthreadinitthreads.c
parentconfig: Bring back RTEMS 4.11 configuration table (diff)
downloadrtems-3b4795b46fa190ea29007a6b9766689cacffe3d2.tar.bz2
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.
Diffstat (limited to '')
-rw-r--r--cpukit/posix/src/pthreadinitthreads.c75
1 files changed, 31 insertions, 44 deletions
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 <errno.h>
+#include <rtems/posix/pthread.h>
+
#include <pthread.h>
-#include <limits.h>
-#include <rtems/config.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/posix/posixapi.h>
-#include <rtems/posix/pthreadimpl.h>
-#include <rtems/posix/priorityimpl.h>
-#include <rtems/posix/config.h>
+#include <rtems/score/assert.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/interr.h>
-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;
}
}