Changeset 3b4795b4 in rtems for cpukit/posix/src/pthreadinitthreads.c
- Timestamp:
- 02/14/20 10:20:42 (4 years ago)
- Branches:
- 5, master
- Children:
- b8648bd
- Parents:
- 9bdb6aa3
- git-author:
- Sebastian Huber <sebastian.huber@…> (02/14/20 10:20:42)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (02/25/20 06:15:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/posix/src/pthreadinitthreads.c
r9bdb6aa3 r3b4795b4 19 19 #endif 20 20 21 #include <errno.h> 21 #include <rtems/posix/pthread.h> 22 22 23 #include <pthread.h> 23 #include <limits.h>24 24 25 #include <rtems/config.h> 26 #include <rtems/score/stack.h> 27 #include <rtems/score/thread.h> 28 #include <rtems/score/wkspace.h> 29 #include <rtems/posix/posixapi.h> 30 #include <rtems/posix/pthreadimpl.h> 31 #include <rtems/posix/priorityimpl.h> 32 #include <rtems/posix/config.h> 25 #include <rtems/score/assert.h> 26 #include <rtems/score/threadimpl.h> 27 #include <rtems/score/interr.h> 33 28 34 void _POSIX_Threads_Initialize_user_thread s_body(void)29 void _POSIX_Threads_Initialize_user_thread( void ) 35 30 { 36 int eno; 37 uint32_t index; 38 uint32_t maximum; 39 posix_initialization_threads_table *user_threads; 40 pthread_t thread_id; 41 pthread_attr_t attr; 31 int eno; 32 const posix_initialization_threads_table *user_thread; 33 pthread_t thread_id; 34 pthread_attr_t attr; 42 35 43 user_threads = _Configuration_POSIX_Initialization_threads; 44 maximum = _Configuration_POSIX_Initialization_thread_count; 45 46 if ( !user_threads ) 47 return; 36 user_thread = &_POSIX_Threads_User_thread_table; 48 37 49 38 /* … … 54 43 */ 55 44 56 for ( index=0 ; index < maximum ; index++ ) { 57 /* 58 * There is no way for these calls to fail in this situation. 59 */ 60 eno = pthread_attr_init( &attr ); 61 _Assert( eno == 0 ); 62 eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); 63 _Assert( eno == 0 ); 64 eno = pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size); 65 _Assert( eno == 0 ); 45 /* 46 * There is no way for these calls to fail in this situation. 47 */ 48 eno = pthread_attr_init( &attr ); 49 _Assert( eno == 0 ); 50 eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); 51 _Assert( eno == 0 ); 52 eno = pthread_attr_setstacksize( &attr, user_thread->stack_size ); 53 _Assert( eno == 0 ); 66 54 67 68 69 70 user_threads[ index ].thread_entry,71 72 73 74 75 55 eno = pthread_create( 56 &thread_id, 57 &attr, 58 user_thread->thread_entry, 59 NULL 60 ); 61 if ( eno != 0 ) { 62 _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED ); 63 } 76 64 77 if ( _Thread_Global_constructor == 0 ) { 78 _Thread_Global_constructor = thread_id; 79 } 65 if ( _Thread_Global_constructor == 0 ) { 66 _Thread_Global_constructor = thread_id; 80 67 } 81 68 }
Note: See TracChangeset
for help on using the changeset viewer.