[PATCH 3/3] posix: Simplify _POSIX_Threads_Create_extension()
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Oct 17 10:11:55 UTC 2017
Move unblocked signals initialization to pthread_create().
Update #2514.
---
cpukit/posix/src/pthread.c | 17 -----------------
cpukit/posix/src/pthreadcreate.c | 4 ++++
2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 8bd44ca03a..ba394b4924 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -122,26 +122,9 @@ static bool _POSIX_Threads_Create_extension(
)
{
POSIX_API_Control *api;
- POSIX_API_Control *executing_api;
api = created->API_Extensions[ THREAD_API_POSIX ];
- /*
- * If the thread is not a posix thread, then all posix signals are blocked
- * by default.
- *
- * The check for class == 1 is debug. Should never really happen.
- */
- RTEMS_STATIC_ASSERT( SIGNAL_EMPTY_MASK == 0, signals_pending );
- if ( _Objects_Get_API( created->Object.id ) == OBJECTS_POSIX_API
- #if defined(RTEMS_DEBUG)
- && _Objects_Get_class( created->Object.id ) == 1
- #endif
- ) {
- executing_api = _Thread_Get_executing()->API_Extensions[ THREAD_API_POSIX ];
- api->signals_unblocked = executing_api->signals_unblocked;
- }
-
api->Sporadic.thread = created;
_Watchdog_Preinitialize( &api->Sporadic.Timer, _Per_CPU_Get_by_index( 0 ) );
_Watchdog_Initialize( &api->Sporadic.Timer, _POSIX_Threads_Sporadic_timer );
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 0de566f7c2..2315b7f5ee 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -74,6 +74,7 @@ int pthread_create(
Thread_Control *executing;
const Scheduler_Control *scheduler;
POSIX_API_Control *api;
+ const POSIX_API_Control *executing_api;
int schedpolicy = SCHED_RR;
struct sched_param schedparam;
Objects_Name name;
@@ -237,6 +238,9 @@ int pthread_create(
* finish initializing the per API structure
*/
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ executing_api = executing->API_Extensions[ THREAD_API_POSIX ];
+
+ api->signals_unblocked = executing_api->signals_unblocked;
api->created_with_explicit_scheduler =
( the_attr->inheritsched == PTHREAD_EXPLICIT_SCHED );
--
2.12.3
More information about the devel
mailing list