[rtems commit] score: replace current and real priority with priority node

Gedare Bloom gedare at rtems.org
Mon Apr 2 03:16:03 UTC 2018


Module:    rtems
Branch:    4.10
Commit:    78b867e26dac3266763f275c1f438da912f33a6e
Changeset: http://git.rtems.org/rtems/commit/?id=78b867e26dac3266763f275c1f438da912f33a6e

Author:    Gedare Bloom <gedare at rtems.org>
Date:      Thu Dec 21 11:49:30 2017 -0500

score: replace current and real priority with priority node

Encapsulate the current_priority and real_priority fields of
the thread control block with a Thread_Priority_node struct.
Propagate modifications throughout the tree where the two
fields are directly accessed.

Updates #3359.

---

 cpukit/itron/src/chg_pri.c                    |  4 ++--
 cpukit/itron/src/ref_tsk.c                    |  2 +-
 cpukit/itron/src/rot_rdq.c                    |  2 +-
 cpukit/libmisc/capture/capture.c              |  8 ++++----
 cpukit/libmisc/capture/capture.h              |  4 ++--
 cpukit/libmisc/monitor/mon-task.c             |  2 +-
 cpukit/posix/src/killinfo.c                   | 12 ++++++------
 cpukit/posix/src/pthread.c                    | 14 +++++++-------
 cpukit/posix/src/pthreadgetschedparam.c       |  2 +-
 cpukit/posix/src/pthreadsetschedparam.c       |  4 ++--
 cpukit/rtems/src/tasksetpriority.c            |  6 +++---
 cpukit/score/include/rtems/score/thread.h     | 25 +++++++++++++++++--------
 cpukit/score/inline/rtems/score/coremutex.inl |  4 ++--
 cpukit/score/src/coremutex.c                  |  4 ++--
 cpukit/score/src/coremutexseize.c             |  4 ++--
 cpukit/score/src/coremutexsurrender.c         | 12 ++++++------
 cpukit/score/src/mpci.c                       |  2 +-
 cpukit/score/src/threadchangepriority.c       |  4 ++--
 cpukit/score/src/threadclearstate.c           |  4 ++--
 cpukit/score/src/threadinitialize.c           |  2 +-
 cpukit/score/src/threadmp.c                   |  2 +-
 cpukit/score/src/threadqenqueuepriority.c     | 10 +++++-----
 cpukit/score/src/threadreset.c                |  4 ++--
 cpukit/score/src/threadresume.c               |  4 ++--
 cpukit/score/src/threadsetpriority.c          |  2 +-
 testsuites/sptests/sp34/changepri.c           |  4 ++--
 testsuites/sptests/sp35/priinv.c              | 17 +++++++++--------
 27 files changed, 87 insertions(+), 77 deletions(-)

diff --git a/cpukit/itron/src/chg_pri.c b/cpukit/itron/src/chg_pri.c
index 0a29128..3845b96 100644
--- a/cpukit/itron/src/chg_pri.c
+++ b/cpukit/itron/src/chg_pri.c
@@ -52,7 +52,7 @@ ER chg_pri(
         _ITRON_return_errorno( E_PAR );
 
       new_priority = _ITRON_Task_Priority_to_Core( tskpri );
-      the_thread->real_priority = new_priority;
+      the_thread->Priority_node.real_priority = new_priority;
 
       /*
        * The priority should not be changed until later if priority
@@ -60,7 +60,7 @@ ER chg_pri(
        */
 
       if ( the_thread->resource_count == 0 ||
-           the_thread->current_priority > new_priority )
+           the_thread->Priority_node.current_priority > new_priority )
         _Thread_Change_priority( the_thread, new_priority, false );
 
       break;
diff --git a/cpukit/itron/src/ref_tsk.c b/cpukit/itron/src/ref_tsk.c
index 7804e96..e428ae8 100644
--- a/cpukit/itron/src/ref_tsk.c
+++ b/cpukit/itron/src/ref_tsk.c
@@ -74,7 +74,7 @@ ER ref_tsk(
 
       pk_rtsk->exinf   = NULL;   /* extended information */
       pk_rtsk->tskpri  =
-                    _ITRON_Task_Core_to_Priority(the_thread->current_priority);
+                    _ITRON_Task_Core_to_Priority(the_thread->Priority_node.current_priority);
 
       /*
        * Mask in the tskstat information
diff --git a/cpukit/itron/src/rot_rdq.c b/cpukit/itron/src/rot_rdq.c
index 9f57321..5487e17 100644
--- a/cpukit/itron/src/rot_rdq.c
+++ b/cpukit/itron/src/rot_rdq.c
@@ -43,7 +43,7 @@ ER rot_rdq(
    * Yield of processor will rotate the queue for this processor.
    */
 
-  priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority);
+  priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->Priority_node.current_priority);
   if ( priority == tskpri )
     _Thread_Yield_processor();
   else {
diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index c8a18fc..da3e95c 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -531,8 +531,8 @@ rtems_capture_record (rtems_capture_task_t* task,
      */
 
     if ((events & RTEMS_CAPTURE_RECORD_EVENTS) ||
-        ((task->tcb->real_priority >= capture_ceiling) &&
-         (task->tcb->real_priority <= capture_floor) &&
+        ((task->tcb->Priority_node.real_priority >= capture_ceiling) &&
+         (task->tcb->Priority_node.real_priority <= capture_floor) &&
          ((capture_flags & RTEMS_CAPTURE_GLOBAL_WATCH) ||
           (control && (control->flags & RTEMS_CAPTURE_WATCH)))))
     {
@@ -545,8 +545,8 @@ rtems_capture_record (rtems_capture_task_t* task,
         capture_count++;
         capture_in->task   = task;
         capture_in->events = (events |
-                              (task->tcb->real_priority) |
-                              (task->tcb->current_priority << 8));
+                              (task->tcb->Priority_node.real_priority) |
+                              (task->tcb->Priority_node.current_priority << 8));
 
         if ((events & RTEMS_CAPTURE_RECORD_EVENTS) == 0)
           task->flags |= RTEMS_CAPTURE_TRACED;
diff --git a/cpukit/libmisc/capture/capture.h b/cpukit/libmisc/capture/capture.h
index 48ba5eb..c8ad0d0 100644
--- a/cpukit/libmisc/capture/capture.h
+++ b/cpukit/libmisc/capture/capture.h
@@ -711,7 +711,7 @@ static inline rtems_task_priority
 rtems_capture_task_real_priority (rtems_capture_task_t* task)
 {
   if (rtems_capture_task_valid (task))
-    return task->tcb->real_priority;
+    return task->tcb->Priority_node.real_priority;
   return 0;
 }
 
@@ -726,7 +726,7 @@ static inline rtems_task_priority
 rtems_capture_task_curr_priority (rtems_capture_task_t* task)
 {
   if (rtems_capture_task_valid (task))
-    return task->tcb->current_priority;
+    return task->tcb->Priority_node.current_priority;
   return 0;
 }
 
diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c
index 6007b3f..015ef6f 100644
--- a/cpukit/libmisc/monitor/mon-task.c
+++ b/cpukit/libmisc/monitor/mon-task.c
@@ -29,7 +29,7 @@ rtems_monitor_task_canonical(
     canonical_task->argument = rtems_thread->Start.numeric_argument;
     canonical_task->stack = rtems_thread->Start.Initial_stack.area;
     canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
-    canonical_task->priority = rtems_thread->current_priority;
+    canonical_task->priority = rtems_thread->Priority_node.current_priority;
     canonical_task->state = rtems_thread->current_state;
     canonical_task->wait_id = rtems_thread->Wait.id;
     canonical_task->events = api->pending_events;
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index 7ab9beb..013334c 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -214,7 +214,7 @@ int killinfo(
         printk("\n 0x%08x/0x%08x %d/%d 0x%08x 1",
           the_thread->Object.id,
           ((interested) ? interested->Object.id : 0),
-          the_thread->current_priority, interested_priority,
+          the_thread->Priority_node.current_priority, interested_priority,
           the_thread->current_state
         );
       #endif
@@ -223,7 +223,7 @@ int killinfo(
        *  If this thread is of lower priority than the interested thread,
        *  go on to the next thread.
        */
-      if ( the_thread->current_priority > interested_priority )
+      if ( the_thread->Priority_node.current_priority > interested_priority )
         continue;
       DEBUG_STEP("2");
 
@@ -250,9 +250,9 @@ int killinfo(
        *        so we never have to worry about deferencing a NULL
        *        interested thread.
        */
-      if ( the_thread->current_priority < interested_priority ) {
+      if ( the_thread->Priority_node.current_priority < interested_priority ) {
         interested   = the_thread;
-        interested_priority = the_thread->current_priority;
+        interested_priority = the_thread->Priority_node.current_priority;
         continue;
       }
       DEBUG_STEP("4");
@@ -270,7 +270,7 @@ int killinfo(
         DEBUG_STEP("5");
         if ( _States_Is_ready( the_thread->current_state ) ) {
           interested          = the_thread;
-          interested_priority = the_thread->current_priority;
+          interested_priority = the_thread->Priority_node.current_priority;
           continue;
         }
 
@@ -281,7 +281,7 @@ int killinfo(
           if ( _States_Is_interruptible_by_signal(the_thread->current_state) ) {
             DEBUG_STEP("8");
             interested          = the_thread;
-            interested_priority = the_thread->current_priority;
+            interested_priority = the_thread->Priority_node.current_priority;
             continue;
           }
         }
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index e335ec0..0383e9c 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -84,20 +84,20 @@ void _POSIX_Threads_Sporadic_budget_TSR(
   the_thread->cpu_time_budget = ticks;
 
   new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority );
-  the_thread->real_priority = new_priority;
+  the_thread->Priority_node.real_priority = new_priority;
 
   /*
    *  If holding a resource, then do not change it.
    */
   #if 0
     printk( "TSR %d %d %d\n", the_thread->resource_count,
-        the_thread->current_priority, new_priority );
+        the_thread->Priority_node.current_priority, new_priority );
   #endif
   if ( the_thread->resource_count == 0 ) {
     /*
      *  If this would make them less important, then do not change it.
      */
-    if ( the_thread->current_priority > new_priority ) {
+    if ( the_thread->Priority_node.current_priority > new_priority ) {
       _Thread_Change_priority( the_thread, new_priority, true );
       #if 0
         printk( "raise priority\n" );
@@ -130,14 +130,14 @@ void _POSIX_Threads_Sporadic_budget_callout(
   the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
 
   new_priority = _POSIX_Priority_To_core(api->schedparam.sched_ss_low_priority);
-  the_thread->real_priority = new_priority;
+  the_thread->Priority_node.real_priority = new_priority;
 
   /*
    *  If holding a resource, then do not change it.
    */
   #if 0
     printk( "callout %d %d %d\n", the_thread->resource_count,
-	the_thread->current_priority, new_priority );
+	the_thread->Priority_node.current_priority, new_priority );
   #endif
   if ( the_thread->resource_count == 0 ) {
     /*
@@ -145,7 +145,7 @@ void _POSIX_Threads_Sporadic_budget_callout(
      *  to logically lower than sched_ss_low_priority, then we do not want to
      *  change it.
      */
-    if ( the_thread->current_priority < new_priority ) {
+    if ( the_thread->Priority_node.current_priority < new_priority ) {
       _Thread_Change_priority( the_thread, new_priority, true );
       #if 0
         printk( "lower priority\n" );
@@ -181,7 +181,7 @@ bool _POSIX_Threads_Create_extension(
   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 );
+     _POSIX_Priority_From_core( created->Priority_node.current_priority );
 
   /*
    *  POSIX 1003.1 1996, 18.2.2.2
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index b8e0a83..4b72ada 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -46,7 +46,7 @@ int pthread_getschedparam(
       if ( param ) {
         *param  = api->schedparam;
         param->sched_priority =
-          _POSIX_Priority_From_core( the_thread->current_priority );
+          _POSIX_Priority_From_core( the_thread->Priority_node.current_priority );
       }
       _Thread_Enable_dispatch();
       return 0;
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 14edfa0..36ce7bb 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -76,12 +76,12 @@ int pthread_setschedparam(
         case SCHED_RR:
           the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
 
-          the_thread->real_priority =
+          the_thread->Priority_node.real_priority =
             _POSIX_Priority_To_core( api->schedparam.sched_priority );
 
           _Thread_Change_priority(
              the_thread,
-             the_thread->real_priority,
+             the_thread->Priority_node.real_priority,
              true
           );
           break;
diff --git a/cpukit/rtems/src/tasksetpriority.c b/cpukit/rtems/src/tasksetpriority.c
index 7499d17..6f365f4 100644
--- a/cpukit/rtems/src/tasksetpriority.c
+++ b/cpukit/rtems/src/tasksetpriority.c
@@ -72,11 +72,11 @@ rtems_status_code rtems_task_set_priority(
 
     case OBJECTS_LOCAL:
       /* XXX need helper to "convert" from core priority */
-      *old_priority = the_thread->current_priority;
+      *old_priority = the_thread->Priority_node.current_priority;
       if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
-        the_thread->real_priority = new_priority;
+        the_thread->Priority_node.real_priority = new_priority;
         if ( the_thread->resource_count == 0 ||
-             the_thread->current_priority > new_priority )
+             the_thread->Priority_node.current_priority > new_priority )
           _Thread_Change_priority( the_thread, new_priority, false );
       }
       _Thread_Enable_dispatch();
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 214f8ce..b0b40f7 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -277,6 +277,17 @@ typedef struct {
 }   Thread_Wait_information;
 
 /**
+ * @brief Encapsulates base and inherited priority.
+ */
+typedef struct Thread_Priority_node {
+  Chain_Node               Node;
+  /** current priority = min(real_priority, min(Inherited_priorities)) */
+  Priority_Control         current_priority;
+  /** base priority irrespective of inheritance/ceiling */
+  Priority_Control         real_priority;
+} Thread_Priority_node;
+
+/**
  *  The following defines the control block used to manage
  *  each thread proxy.
  *
@@ -288,10 +299,9 @@ typedef struct {
   Objects_Control          Object;
   /** This field is the current execution state of this proxy. */
   States_Control           current_state;
-  /** This field is the current priority state of this proxy. */
-  Priority_Control         current_priority;
-  /** This field is the base priority of this proxy. */
-  Priority_Control         real_priority;
+  /** This field encapsulates the base and current (inherited) priority
+   * of this proxy. */
+  Thread_Priority_node     Priority_node;
   /** This field is the number of mutexes currently held by this proxy. */
   uint32_t                 resource_count;
 
@@ -338,10 +348,9 @@ struct Thread_Control_struct {
   Objects_Control          Object;
   /** This field is the current execution state of this thread. */
   States_Control           current_state;
-  /** This field is the current priority state of this thread. */
-  Priority_Control         current_priority;
-  /** This field is the base priority of this thread. */
-  Priority_Control         real_priority;
+  /** This field encapsulates the base and current (inherited) priority
+   * of this thread. */
+  Thread_Priority_node     Priority_node;
   /** This field is the number of mutexes currently held by this thread. */
   uint32_t                 resource_count;
   /** This field is the blocking information for this thread. */
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
index 9f6d749..eb22e1d 100644
--- a/cpukit/score/inline/rtems/score/coremutex.inl
+++ b/cpukit/score/inline/rtems/score/coremutex.inl
@@ -146,7 +146,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
 #ifdef __RTEMS_STRICT_ORDER_MUTEX__
        _Chain_Prepend_unprotected( &executing->lock_mutex,
                                    &the_mutex->queue.lock_queue );
-       the_mutex->queue.priority_before = executing->current_priority;
+       the_mutex->queue.priority_before = executing->Priority_node.current_priority;
 #endif
 
       executing->resource_count++;
@@ -165,7 +165,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
       Priority_Control  current;
 
       ceiling = the_mutex->Attributes.priority_ceiling;
-      current = executing->current_priority;
+      current = executing->Priority_node.current_priority;
       if ( current == ceiling ) {
         _ISR_Enable( *level_p );
         return 0;
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 261e18e..6540afd 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -71,12 +71,12 @@ CORE_mutex_Status _CORE_mutex_Initialize(
       Priority_Control ceiling = the_mutex->Attributes.priority_ceiling;
 
       if ( is_priority_ceiling &&
-           _Thread_Executing->current_priority < ceiling )
+           _Thread_Executing->Priority_node.current_priority < ceiling )
        return CORE_MUTEX_STATUS_CEILING_VIOLATED;
 #ifdef __RTEMS_STRICT_ORDER_MUTEX__
        _Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex,
                                    &the_mutex->queue.lock_queue );
-       the_mutex->queue.priority_before = _Thread_Executing->current_priority;
+       the_mutex->queue.priority_before = _Thread_Executing->Priority_node.current_priority;
 #endif
 
       _Thread_Executing->resource_count++;
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index db6d513..c19d868 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -61,10 +61,10 @@ void _CORE_mutex_Seize_interrupt_blocking(
 
   executing = _Thread_Executing;
   if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
-    if ( the_mutex->holder->current_priority > executing->current_priority ) {
+    if ( the_mutex->holder->Priority_node.current_priority > executing->Priority_node.current_priority ) {
       _Thread_Change_priority(
         the_mutex->holder,
-        executing->current_priority,
+        executing->Priority_node.current_priority,
         false
       );
     }
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 4d215bb..2ed2afe 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -135,12 +135,12 @@ CORE_mutex_Status _CORE_mutex_Surrender(
   if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
        _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
 #ifdef __RTEMS_STRICT_ORDER_MUTEX__
-    if(the_mutex->queue.priority_before != holder->current_priority)
+    if(the_mutex->queue.priority_before != holder->Priority_node.current_priority)
       _Thread_Change_priority(holder,the_mutex->queue.priority_before,true);
 #endif
     if ( holder->resource_count == 0 &&
-         holder->real_priority != holder->current_priority ) {
-      _Thread_Change_priority( holder, holder->real_priority, true );
+         holder->Priority_node.real_priority != holder->Priority_node.current_priority ) {
+      _Thread_Change_priority( holder, holder->Priority_node.real_priority, true );
     }
   }
 
@@ -174,18 +174,18 @@ CORE_mutex_Status _CORE_mutex_Surrender(
         case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
 #ifdef __RTEMS_STRICT_ORDER_MUTEX__
 	  _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
-	  the_mutex->queue.priority_before = the_thread->current_priority;
+	  the_mutex->queue.priority_before = the_thread->Priority_node.current_priority;
 #endif
           the_thread->resource_count++;
           break;
         case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
 #ifdef __RTEMS_STRICT_ORDER_MUTEX__
 	  _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
-	  the_mutex->queue.priority_before = the_thread->current_priority;
+	  the_mutex->queue.priority_before = the_thread->Priority_node.current_priority;
 #endif
           the_thread->resource_count++;
           if (the_mutex->Attributes.priority_ceiling <
-              the_thread->current_priority){
+              the_thread->Priority_node.current_priority){
               _Thread_Change_priority(
                 the_thread,
                 the_mutex->Attributes.priority_ceiling,
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index d8f68eb..140263d 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -254,7 +254,7 @@ uint32_t   _MPCI_Send_request_packet (
 )
 {
   the_packet->source_tid      = _Thread_Executing->Object.id;
-  the_packet->source_priority = _Thread_Executing->current_priority;
+  the_packet->source_priority = _Thread_Executing->Priority_node.current_priority;
   the_packet->to_convert =
      ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
 
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index b3b3eeb..d109dd9 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -68,7 +68,7 @@ void _Thread_Change_priority(
 /*
   if ( prepend_it &&
        _Thread_Is_executing( the_thread ) &&
-       new_priority >= the_thread->current_priority )
+       new_priority >= the_thread->Priority_node.current_priority )
     prepend_it = true;
 */
 
@@ -88,7 +88,7 @@ void _Thread_Change_priority(
    *  Do not bother recomputing all the priority related information if
    *  we are not REALLY changing priority.
    */
- if ( the_thread->current_priority != new_priority )
+ if ( the_thread->Priority_node.current_priority != new_priority )
     _Thread_Set_priority( the_thread, new_priority );
 
   _ISR_Disable( level );
diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
index 617f271..f105824 100644
--- a/cpukit/score/src/threadclearstate.c
+++ b/cpukit/score/src/threadclearstate.c
@@ -84,10 +84,10 @@ void _Thread_Clear_state(
          *    Even if the thread isn't preemptible, if the new heir is
          *    a pseudo-ISR system task, we need to do a context switch.
          */
-        if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
+        if ( the_thread->Priority_node.current_priority < _Thread_Heir->Priority_node.current_priority ) {
           _Thread_Heir = the_thread;
           if ( _Thread_Executing->is_preemptible ||
-               the_thread->current_priority == 0 )
+               the_thread->Priority_node.current_priority == 0 )
             _Context_Switch_necessary = true;
         }
       }
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 91522fb..a02c729 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -192,7 +192,7 @@ bool _Thread_Initialize(
   #if defined(RTEMS_ITRON_API)
     the_thread->suspend_count         = 0;
   #endif
-  the_thread->real_priority           = priority;
+  the_thread->Priority_node.real_priority           = priority;
   the_thread->Start.initial_priority  = priority;
   _Thread_Set_priority( the_thread, priority );
 
diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
index 2b4137f..0427b1e 100644
--- a/cpukit/score/src/threadmp.c
+++ b/cpukit/score/src/threadmp.c
@@ -78,7 +78,7 @@ Thread_Control *_Thread_MP_Allocate_proxy (
 
     the_proxy->Object.id = _MPCI_Receive_server_tcb->receive_packet->source_tid;
 
-    the_proxy->current_priority =
+    the_proxy->Priority_node.current_priority =
       _MPCI_Receive_server_tcb->receive_packet->source_priority;
 
     the_proxy->current_state = _States_Set( STATES_DORMANT, the_state );
diff --git a/cpukit/score/src/threadqenqueuepriority.c b/cpukit/score/src/threadqenqueuepriority.c
index f2652ea..caf65ff 100644
--- a/cpukit/score/src/threadqenqueuepriority.c
+++ b/cpukit/score/src/threadqenqueuepriority.c
@@ -69,7 +69,7 @@ Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
 
   _Chain_Initialize_empty( &the_thread->Wait.Block2n );
 
-  priority     = the_thread->current_priority;
+  priority     = the_thread->Priority_node.current_priority;
   header_index = _Thread_queue_Header_number( priority );
   header       = &the_thread_queue->Queues.Priority[ header_index ];
   block_state  = the_thread_queue->state;
@@ -82,7 +82,7 @@ restart_forward_search:
   _ISR_Disable( level );
   search_thread = (Thread_Control *) header->first;
   while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) {
-    search_priority = search_thread->current_priority;
+    search_priority = search_thread->Priority_node.current_priority;
     if ( priority <= search_priority )
       break;
 
@@ -90,7 +90,7 @@ restart_forward_search:
     search_thread = (Thread_Control *) search_thread->Object.Node.next;
     if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) )
       break;
-    search_priority = search_thread->current_priority;
+    search_priority = search_thread->Priority_node.current_priority;
     if ( priority <= search_priority )
       break;
 #endif
@@ -130,14 +130,14 @@ restart_reverse_search:
   _ISR_Disable( level );
   search_thread = (Thread_Control *) header->last;
   while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) {
-    search_priority = search_thread->current_priority;
+    search_priority = search_thread->Priority_node.current_priority;
     if ( priority >= search_priority )
       break;
 #if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE )
     search_thread = (Thread_Control *) search_thread->Object.Node.previous;
     if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) )
       break;
-    search_priority = search_thread->current_priority;
+    search_priority = search_thread->Priority_node.current_priority;
     if ( priority >= search_priority )
       break;
 #endif
diff --git a/cpukit/score/src/threadreset.c b/cpukit/score/src/threadreset.c
index a99aa45..fd55ca3 100644
--- a/cpukit/score/src/threadreset.c
+++ b/cpukit/score/src/threadreset.c
@@ -63,8 +63,8 @@ void _Thread_Reset(
       (void) _Watchdog_Remove( &the_thread->Timer );
   }
 
-  if ( the_thread->current_priority != the_thread->Start.initial_priority ) {
-    the_thread->real_priority = the_thread->Start.initial_priority;
+  if ( the_thread->Priority_node.current_priority != the_thread->Start.initial_priority ) {
+    the_thread->Priority_node.real_priority = the_thread->Start.initial_priority;
     _Thread_Set_priority( the_thread, the_thread->Start.initial_priority );
   }
 }
diff --git a/cpukit/score/src/threadresume.c b/cpukit/score/src/threadresume.c
index cea8849..4466b96 100644
--- a/cpukit/score/src/threadresume.c
+++ b/cpukit/score/src/threadresume.c
@@ -87,10 +87,10 @@ void _Thread_Resume(
 
       _ISR_Flash( level );
 
-      if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
+      if ( the_thread->Priority_node.current_priority < _Thread_Heir->Priority_node.current_priority ) {
         _Thread_Heir = the_thread;
         if ( _Thread_Executing->is_preemptible ||
-             the_thread->current_priority == 0 )
+             the_thread->Priority_node.current_priority == 0 )
           _Context_Switch_necessary = true;
       }
     }
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index a4837ca..2460910 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -48,7 +48,7 @@ void _Thread_Set_priority(
   Priority_Control  new_priority
 )
 {
-  the_thread->current_priority = new_priority;
+  the_thread->Priority_node.current_priority = new_priority;
   the_thread->ready            = &_Thread_Ready_chain[ new_priority ];
 
   _Priority_Initialize_information( &the_thread->Priority_map, new_priority );
diff --git a/testsuites/sptests/sp34/changepri.c b/testsuites/sptests/sp34/changepri.c
index ef54b96..5f7e031 100644
--- a/testsuites/sptests/sp34/changepri.c
+++ b/testsuites/sptests/sp34/changepri.c
@@ -39,7 +39,7 @@ const char *CallerName(void)
   static char buffer[32];
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), _Thread_Executing->current_priority );
+      rtems_task_self(), _Thread_Executing->Priority_node.current_priority );
 #else
   volatile union {
     uint32_t u;
@@ -53,7 +53,7 @@ const char *CallerName(void)
   #endif
     sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
       TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
-      _Thread_Executing->current_priority
+      _Thread_Executing->Priority_node.current_priority
   );
 #endif
   return buffer;
diff --git a/testsuites/sptests/sp35/priinv.c b/testsuites/sptests/sp35/priinv.c
index 19362a9..6a0042c 100644
--- a/testsuites/sptests/sp35/priinv.c
+++ b/testsuites/sptests/sp35/priinv.c
@@ -81,7 +81,8 @@ const char *CallerName(void)
   static char buffer[32];
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), _Thread_Executing->current_priority );
+      rtems_task_self(), _Thread_Executing->Priority_node.current_priority
+  );
 #else
   volatile union {
     uint32_t u;
@@ -95,7 +96,7 @@ const char *CallerName(void)
   #endif
   sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
       TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
-      _Thread_Executing->current_priority
+      _Thread_Executing->Priority_node.current_priority
   );
 #endif
   return buffer;
@@ -247,7 +248,7 @@ void AccessLocalHw(void)
   uint32_t              LeaveCnt;    /*      :         */
 
   /* Store information about the current situation */
-  EnterPrio = _Thread_Executing->current_priority;
+  EnterPrio = _Thread_Executing->Priority_node.current_priority;
   EnterCnt  = _Thread_Executing->resource_count;
 
 
@@ -266,14 +267,14 @@ void AccessLocalHw(void)
   directive_failed( Sts, "rtems_semaphore_obtain(LocalHwAccess_R...)" );
 
   /* Store information about the current situation */
-  AccessPrio = _Thread_Executing->current_priority;
+  AccessPrio = _Thread_Executing->Priority_node.current_priority;
   AccessCnt  = _Thread_Executing->resource_count;
 
   Sts = rtems_semaphore_release(LocalHwAccess_R);
   directive_failed( Sts, "rtems_semaphore_release(LocalHwAccess_R)" );
 
   /* Store information about the current situation */
-  LeavePrio = _Thread_Executing->current_priority;
+  LeavePrio = _Thread_Executing->Priority_node.current_priority;
   LeaveCnt  = _Thread_Executing->resource_count;
 
 #if defined(TEST_PRINT_STATISTICS)
@@ -308,7 +309,7 @@ void AccessRemoteHw(void)
   uint32_t              LeaveCnt;    /*      :         */
 
   /* Store information about the current situation */
-  EnterPrio = _Thread_Executing->current_priority;
+  EnterPrio = _Thread_Executing->Priority_node.current_priority;
   EnterCnt  = _Thread_Executing->resource_count;
 
 
@@ -326,14 +327,14 @@ void AccessRemoteHw(void)
   AccessLocalHw();
 
   /* Store information about the current situation */
-  AccessPrio = _Thread_Executing->current_priority;
+  AccessPrio = _Thread_Executing->Priority_node.current_priority;
   AccessCnt  = _Thread_Executing->resource_count;
 
   Sts = rtems_semaphore_release(RemoteHwAccess_R);
   directive_failed( Sts, "rtems_semaphore_release(RemoreHwAccess_R" );
 
   /* Store information about the current situation */
-  LeavePrio = _Thread_Executing->current_priority;
+  LeavePrio = _Thread_Executing->Priority_node.current_priority;
   LeaveCnt  = _Thread_Executing->resource_count;
 
 #if defined(TEST_PRINT_STATISTICS)



More information about the vc mailing list