[rtems commit] posix: Delete POSIX_API_Control::schedparam

Sebastian Huber sebh at rtems.org
Wed Jun 22 12:46:44 UTC 2016


Module:    rtems
Branch:    master
Commit:    6bab009a61ae9ca7f7ac76140f8f13fbaab784c6
Changeset: http://git.rtems.org/rtems/commit/?id=6bab009a61ae9ca7f7ac76140f8f13fbaab784c6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 14 17:23:03 2016 +0200

posix: Delete POSIX_API_Control::schedparam

This field was redundant.

---

 cpukit/posix/include/rtems/posix/threadsup.h |  4 ++--
 cpukit/posix/src/pthread.c                   | 14 +++++++++-----
 cpukit/posix/src/pthreadcreate.c             |  3 +--
 cpukit/posix/src/pthreadgetschedparam.c      |  2 +-
 cpukit/posix/src/pthreadsetschedparam.c      |  5 +++--
 cpukit/posix/src/pthreadsetschedprio.c       |  1 -
 cpukit/score/include/rtems/score/thread.h    |  1 -
 7 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
index a9f36ef..e18a429 100644
--- a/cpukit/posix/include/rtems/posix/threadsup.h
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -45,10 +45,10 @@ extern "C" {
 typedef struct {
   /** Back pointer to thread of this POSIX API control. */
   Thread_Control         *thread;
+
   /** This is the POSIX threads attribute set. */
   pthread_attr_t          Attributes;
-  /** This is the thread's current set of scheduling parameters. */
-  struct sched_param      schedparam;
+
   /**
    * This is the timer which controls when the thread executes at
    * high and low priority when using the sporadic scheduler.
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 33c2830..ead24cf 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -116,7 +116,9 @@ void _POSIX_Threads_Sporadic_budget_TSR( Watchdog_Control *watchdog )
   _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer );
   _POSIX_Threads_Sporadic_timer_insert( the_thread, api );
 
-  new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority );
+  new_priority = _POSIX_Priority_To_core(
+    api->Attributes.schedparam.sched_priority
+  );
 
   _Thread_State_release( the_thread, &lock_context );
 
@@ -167,7 +169,9 @@ void _POSIX_Threads_Sporadic_budget_callout(
 
   _Thread_Change_priority(
     the_thread,
-    _POSIX_Priority_To_core( api->schedparam.sched_ss_low_priority ),
+    _POSIX_Priority_To_core(
+      api->Attributes.schedparam.sched_ss_low_priority
+    ),
     NULL,
     _POSIX_Threads_Sporadic_budget_callout_filter,
     true
@@ -193,9 +197,9 @@ static bool _POSIX_Threads_Create_extension(
   /* XXX check all fields are touched */
   api->thread = created;
   _POSIX_Threads_Initialize_attributes( &api->Attributes );
-  api->schedparam  = _POSIX_Threads_Default_attributes.schedparam;
-  api->schedparam.sched_priority =
-     _POSIX_Priority_From_core( created->current_priority );
+  api->Attributes.schedparam.sched_priority = _POSIX_Priority_From_core(
+    created->current_priority
+  );
 
   /*
    *  If the thread is not a posix thread, then all posix signals are blocked
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 019ccc8..c7c2338 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -111,7 +111,7 @@ int pthread_create(
     case PTHREAD_INHERIT_SCHED:
       api = executing->API_Extensions[ THREAD_API_POSIX ];
       schedpolicy = api->Attributes.schedpolicy;
-      schedparam  = api->schedparam;
+      schedparam  = api->Attributes.schedparam;
       break;
 
     case PTHREAD_EXPLICIT_SCHED:
@@ -226,7 +226,6 @@ int pthread_create(
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
 
   _POSIX_Threads_Copy_attributes( &api->Attributes, the_attr );
-  api->schedparam  = schedparam;
 
   if ( schedpolicy == SCHED_SPORADIC ) {
     _ISR_lock_ISR_disable( &lock_context );
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index d03a8a8..ed149f2 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -52,7 +52,7 @@ int pthread_getschedparam(
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
   *policy = api->Attributes.schedpolicy;
-  *param  = api->schedparam;
+  *param  = api->Attributes.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 30ddd03..a2e13a0 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -84,7 +84,6 @@ int pthread_setschedparam(
     _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer );
   }
 
-  api->schedparam  = *param;
   api->Attributes.schedpolicy = policy;
   api->Attributes.schedparam  = *param;
 
@@ -97,7 +96,9 @@ int pthread_setschedparam(
     case SCHED_RR:
       the_thread->cpu_time_budget =
         rtems_configuration_get_ticks_per_timeslice();
-      new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority );
+      new_priority = _POSIX_Priority_To_core(
+        api->Attributes.schedparam.sched_priority
+      );
       break;
   }
 
diff --git a/cpukit/posix/src/pthreadsetschedprio.c b/cpukit/posix/src/pthreadsetschedprio.c
index 856e49d..b7166bc 100644
--- a/cpukit/posix/src/pthreadsetschedprio.c
+++ b/cpukit/posix/src/pthreadsetschedprio.c
@@ -43,7 +43,6 @@ int pthread_setschedprio( pthread_t thread, int prio )
   cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
 
   _Thread_State_acquire_critical( the_thread, &lock_context );
-  api->schedparam.sched_priority = prio;
   api->Attributes.schedparam.sched_priority = prio;
   _Thread_State_release( the_thread, &lock_context );
 
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index d98658c..7c5f079 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -711,7 +711,6 @@ struct _Thread_Control {
    * the following fields
    *
    * - POSIX_API_Control::Attributes,
-   * - POSIX_API_Control::schedparam,
    * - RTEMS_API_Control::Signal,
    * - Thread_Control::budget_algorithm,
    * - Thread_Control::budget_callout,




More information about the vc mailing list