[PATCH 04/16] posix: Delete POSIX_API_Control::schedpolicy

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 17 10:51:41 UTC 2016


This field was redundant.
---
 cpukit/posix/include/rtems/posix/threadsup.h | 2 --
 cpukit/posix/src/pthread.c                   | 3 +--
 cpukit/posix/src/pthreadcreate.c             | 3 +--
 cpukit/posix/src/pthreadgetschedparam.c      | 2 +-
 cpukit/posix/src/pthreadsetschedparam.c      | 3 +--
 cpukit/score/include/rtems/score/thread.h    | 1 -
 6 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
index 60bf0e4..a9f36ef 100644
--- a/cpukit/posix/include/rtems/posix/threadsup.h
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -47,8 +47,6 @@ typedef struct {
   Thread_Control         *thread;
   /** This is the POSIX threads attribute set. */
   pthread_attr_t          Attributes;
-  /** This is the thread's current scheduling policy. */
-  int                     schedpolicy;
   /** This is the thread's current set of scheduling parameters. */
   struct sched_param      schedparam;
   /**
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 432f70c..33c2830 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -193,7 +193,6 @@ static bool _POSIX_Threads_Create_extension(
   /* XXX check all fields are touched */
   api->thread = created;
   _POSIX_Threads_Initialize_attributes( &api->Attributes );
-  api->schedpolicy = _POSIX_Threads_Default_attributes.schedpolicy;
   api->schedparam  = _POSIX_Threads_Default_attributes.schedparam;
   api->schedparam.sched_priority =
      _POSIX_Priority_From_core( created->current_priority );
@@ -232,7 +231,7 @@ static void _POSIX_Threads_Terminate_extension( Thread_Control *executing )
 
   _Thread_State_acquire( executing, &lock_context );
 
-  if ( api->schedpolicy == SCHED_SPORADIC ) {
+  if ( api->Attributes.schedpolicy == SCHED_SPORADIC ) {
     _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer );
   }
 
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index a120fdd..019ccc8 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -110,7 +110,7 @@ int pthread_create(
   switch ( the_attr->inheritsched ) {
     case PTHREAD_INHERIT_SCHED:
       api = executing->API_Extensions[ THREAD_API_POSIX ];
-      schedpolicy = api->schedpolicy;
+      schedpolicy = api->Attributes.schedpolicy;
       schedparam  = api->schedparam;
       break;
 
@@ -226,7 +226,6 @@ int pthread_create(
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
 
   _POSIX_Threads_Copy_attributes( &api->Attributes, the_attr );
-  api->schedpolicy = schedpolicy;
   api->schedparam  = schedparam;
 
   if ( schedpolicy == SCHED_SPORADIC ) {
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index 9b6969c..d03a8a8 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -51,7 +51,7 @@ int pthread_getschedparam(
   _Thread_State_acquire_critical( the_thread, &lock_context );
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
-  *policy = api->schedpolicy;
+  *policy = api->Attributes.schedpolicy;
   *param  = api->schedparam;
   param->sched_priority = _POSIX_Priority_From_core(
     the_thread->real_priority
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 55019dd..30ddd03 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -80,11 +80,10 @@ int pthread_setschedparam(
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
 
-  if ( api->schedpolicy == SCHED_SPORADIC ) {
+  if ( api->Attributes.schedpolicy == SCHED_SPORADIC ) {
     _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer );
   }
 
-  api->schedpolicy = policy;
   api->schedparam  = *param;
   api->Attributes.schedpolicy = policy;
   api->Attributes.schedparam  = *param;
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 7491e8f..d98658c 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -712,7 +712,6 @@ struct _Thread_Control {
    *
    * - POSIX_API_Control::Attributes,
    * - POSIX_API_Control::schedparam,
-   * - POSIX_API_Control::schedpolicy,
    * - RTEMS_API_Control::Signal,
    * - Thread_Control::budget_algorithm,
    * - Thread_Control::budget_callout,
-- 
1.8.4.5




More information about the devel mailing list