diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-07 09:55:45 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-11 08:47:01 +0100 |
commit | ccd54344d904b657123e4e4ba795a32212382be2 (patch) | |
tree | d490d77b6173f586137036ed07ec5bd27d8ca65a /cpukit/posix | |
parent | smptests/README: Delete obsolete information (diff) | |
download | rtems-ccd54344d904b657123e4e4ba795a32212382be2.tar.bz2 |
score: Introduce Thread_Entry_information
This avoids potential dead code in _Thread_Handler(). It gets rid of
the dangerous function pointer casts.
Update #2514.
Diffstat (limited to 'cpukit/posix')
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 18 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadinitthreads.c | 7 |
2 files changed, 15 insertions, 10 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index 59c4e66e9d..611477ec69 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -52,6 +52,15 @@ int pthread_create( void *arg ) { + Thread_Entry_information entry = { + .adaptor = _Thread_Entry_adaptor_pointer, + .Kinds = { + .Pointer = { + .entry = start_routine, + .argument = arg + } + } + }; const pthread_attr_t *the_attr; Priority_Control core_priority; Thread_CPU_budget_algorithms budget_algorithm; @@ -219,14 +228,7 @@ int pthread_create( /* * POSIX threads are allocated and started in one operation. */ - status = _Thread_Start( - the_thread, - THREAD_START_POINTER, - start_routine, - arg, - 0, /* unused */ - NULL - ); + status = _Thread_Start( the_thread, &entry, NULL ); #if defined(RTEMS_DEBUG) /* diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 5accf3907c..c1f9340f63 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -37,11 +37,14 @@ static void *_POSIX_Global_construction( void *arg ) { - Thread_Entry entry_point = (Thread_Entry) Configuration_POSIX_API + 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( entry_point ); + _Thread_Global_construction( executing, &entry ); } void _POSIX_Threads_Initialize_user_threads_body(void) |