[PATCH 7/8] score: Introduce _Thread_Get_priority()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 6 12:40:27 UTC 2016


Avoid direct access to thread internal data fields.
---
 cpukit/libmisc/capture/capture.h                       |  2 +-
 cpukit/libmisc/cpuuse/cpuusagetop.c                    |  8 ++++++--
 cpukit/libmisc/monitor/mon-task.c                      |  2 +-
 cpukit/posix/src/killinfo.c                            | 12 ++++++------
 cpukit/posix/src/pthread.c                             |  6 +++---
 cpukit/posix/src/pthreadsetschedparam.c                |  2 +-
 cpukit/posix/src/pthreadsetschedprio.c                 |  2 +-
 cpukit/rtems/src/tasksetpriority.c                     |  4 ++--
 cpukit/score/include/rtems/score/coremuteximpl.h       |  2 +-
 cpukit/score/include/rtems/score/mrspimpl.h            |  4 ++--
 cpukit/score/include/rtems/score/schedulersimpleimpl.h |  6 ++++--
 cpukit/score/include/rtems/score/threadimpl.h          | 18 ++++++++++++++++++
 cpukit/score/src/mpci.c                                |  2 +-
 cpukit/score/src/schedulercbsunblock.c                 |  8 +++++---
 cpukit/score/src/scheduleredfreleasejob.c              |  4 ++--
 cpukit/score/src/scheduleredfunblock.c                 |  2 +-
 cpukit/score/src/schedulerpriorityunblock.c            |  2 +-
 cpukit/score/src/schedulersimpleunblock.c              | 10 ++++++----
 cpukit/score/src/threadchangepriority.c                |  4 ++--
 cpukit/score/src/threadqops.c                          |  4 ++--
 cpukit/score/src/threadrestart.c                       |  4 ++--
 cpukit/score/src/threadsetpriority.c                   |  2 +-
 testsuites/smptests/smpscheduler03/init.c              |  2 +-
 testsuites/sptests/sp34/changepri.c                    |  6 ++++--
 testsuites/sptests/sp35/priinv.c                       | 18 ++++++++++--------
 25 files changed, 84 insertions(+), 52 deletions(-)

diff --git a/cpukit/libmisc/capture/capture.h b/cpukit/libmisc/capture/capture.h
index b22b735..0f3635c 100644
--- a/cpukit/libmisc/capture/capture.h
+++ b/cpukit/libmisc/capture/capture.h
@@ -903,7 +903,7 @@ rtems_capture_task_real_priority (rtems_tcb* tcb)
 static inline rtems_task_priority
 rtems_capture_task_curr_priority (rtems_tcb* tcb)
 {
-  return tcb->current_priority;
+  return _Thread_Get_priority (tcb);
 }
 
 /**
diff --git a/cpukit/libmisc/cpuuse/cpuusagetop.c b/cpukit/libmisc/cpuuse/cpuusagetop.c
index aa2b74c..ccf32de 100644
--- a/cpukit/libmisc/cpuuse/cpuusagetop.c
+++ b/cpukit/libmisc/cpuuse/cpuusagetop.c
@@ -264,8 +264,12 @@ task_usage(Thread_Control* thread, void* arg)
           if (thread->real_priority > data->tasks[j]->real_priority)
             continue;
         case RTEMS_TOP_SORT_CURRENT_PRI:
-          if (thread->current_priority > data->tasks[j]->current_priority)
+          if (
+            _Thread_Get_priority( thread )
+              > _Thread_Get_priority( data->tasks[j] )
+          ) {
             continue;
+          }
         case RTEMS_TOP_SORT_ID:
           if (thread->Object.id < data->tasks[j]->Object.id)
             continue;
@@ -478,7 +482,7 @@ rtems_cpuusage_top_thread (rtems_task_argument arg)
                    thread->Object.id,
                    name,
                    thread->real_priority,
-                   thread->current_priority);
+                   _Thread_Get_priority(thread));
 
       usage = data->usage[i];
       current_usage = data->current_usage[i];
diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c
index eedba3e..af376d5 100644
--- a/cpukit/libmisc/monitor/mon-task.c
+++ b/cpukit/libmisc/monitor/mon-task.c
@@ -52,7 +52,7 @@ rtems_monitor_task_canonical(
     canonical_task->stack = rtems_thread->Start.Initial_stack.area;
     canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
     canonical_task->cpu = _Per_CPU_Get_index( _Thread_Get_CPU( rtems_thread ) );
-    canonical_task->priority = rtems_thread->current_priority;
+    canonical_task->priority = _Thread_Get_priority( rtems_thread );
     canonical_task->events = api->Event.pending_events;
     /*
      * FIXME: make this optionally cpu_time_executed
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index 2e7bacb..7cf74eb 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -220,7 +220,7 @@ int _POSIX_signals_Send(
         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,
+          _Thread_Get_priority( the_thread ), interested_priority,
           the_thread->current_state
         );
       #endif
@@ -229,7 +229,7 @@ int _POSIX_signals_Send(
        *  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 ( _Thread_Get_priority( the_thread ) > interested_priority )
         continue;
       DEBUG_STEP("2");
 
@@ -256,9 +256,9 @@ int _POSIX_signals_Send(
        *        so we never have to worry about deferencing a NULL
        *        interested thread.
        */
-      if ( the_thread->current_priority < interested_priority ) {
+      if ( _Thread_Get_priority( the_thread ) < interested_priority ) {
         interested   = the_thread;
-        interested_priority = the_thread->current_priority;
+        interested_priority = _Thread_Get_priority( the_thread );
         continue;
       }
       DEBUG_STEP("4");
@@ -276,7 +276,7 @@ int _POSIX_signals_Send(
         DEBUG_STEP("5");
         if ( _States_Is_ready( the_thread->current_state ) ) {
           interested          = the_thread;
-          interested_priority = the_thread->current_priority;
+          interested_priority = _Thread_Get_priority( the_thread );
           continue;
         }
 
@@ -287,7 +287,7 @@ int _POSIX_signals_Send(
           if ( _States_Is_interruptible_by_signal(the_thread->current_state) ) {
             DEBUG_STEP("8");
             interested          = the_thread;
-            interested_priority = the_thread->current_priority;
+            interested_priority = _Thread_Get_priority( the_thread );
             continue;
           }
         }
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index b29acae..a1394a5 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -97,7 +97,7 @@ static bool _POSIX_Threads_Sporadic_timer_filter(
   new_priority = api->Sporadic.high_priority;
   *new_priority_p = new_priority;
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   the_thread->real_priority = new_priority;
 
   _Watchdog_Per_CPU_remove_relative( &api->Sporadic.Timer );
@@ -145,7 +145,7 @@ static bool _POSIX_Threads_Sporadic_budget_callout_filter(
   new_priority = api->Sporadic.low_priority;
   *new_priority_p = new_priority;
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   the_thread->real_priority = new_priority;
 
   return _Thread_Priority_less_than( current_priority, new_priority )
@@ -184,7 +184,7 @@ static bool _POSIX_Threads_Create_extension(
   _POSIX_Threads_Initialize_attributes( &api->Attributes );
   api->Attributes.schedparam.sched_priority = _POSIX_Priority_From_core(
     _Scheduler_Get_own( created ),
-    created->current_priority
+    _Thread_Get_priority( created )
   );
 
   /*
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 92560fc..e3711e3 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -81,7 +81,7 @@ static bool _POSIX_Set_sched_param_filter(
 
   *new_priority_p = core_high_prio;
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   the_thread->real_priority = core_high_prio;
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
diff --git a/cpukit/posix/src/pthreadsetschedprio.c b/cpukit/posix/src/pthreadsetschedprio.c
index fd77b68..fac86d2 100644
--- a/cpukit/posix/src/pthreadsetschedprio.c
+++ b/cpukit/posix/src/pthreadsetschedprio.c
@@ -49,7 +49,7 @@ static bool _POSIX_Set_sched_prio_filter(
 
   *new_priority_p = new_priority;
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   the_thread->real_priority = new_priority;
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
diff --git a/cpukit/rtems/src/tasksetpriority.c b/cpukit/rtems/src/tasksetpriority.c
index 0a2df6e..9779c97 100644
--- a/cpukit/rtems/src/tasksetpriority.c
+++ b/cpukit/rtems/src/tasksetpriority.c
@@ -43,7 +43,7 @@ static bool _RTEMS_tasks_Set_priority_filter(
 
   context = arg;
   scheduler = _Scheduler_Get_own( the_thread );
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
 
   context->scheduler = scheduler;
   context->old_priority = current_priority;
@@ -117,7 +117,7 @@ rtems_status_code rtems_task_set_priority(
   } else {
     _Thread_State_acquire_critical( the_thread, &lock_context );
     scheduler = _Scheduler_Get_own( the_thread );
-    old_priority = the_thread->current_priority;
+    old_priority = _Thread_Get_priority( the_thread );
     _Thread_State_release( the_thread, &lock_context );
     status = RTEMS_SUCCESSFUL;
   }
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index d40d91c..25094a4 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -393,7 +393,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Set_owner(
   Per_CPU_Control  *cpu_self;
 
   priority_ceiling = the_mutex->priority_ceiling;
-  current_priority = owner->current_priority;
+  current_priority = _Thread_Get_priority( owner );
 
   if ( current_priority < priority_ceiling ) {
     _CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h
index 70d4964..1b02bc2 100644
--- a/cpukit/score/include/rtems/score/mrspimpl.h
+++ b/cpukit/score/include/rtems/score/mrspimpl.h
@@ -88,7 +88,7 @@ RTEMS_INLINE_ROUTINE bool _MRSP_Restore_priority_filter(
     *new_priority
   );
 
-  return *new_priority != thread->current_priority;
+  return *new_priority != _Thread_Get_priority( thread );
 }
 
 RTEMS_INLINE_ROUTINE void _MRSP_Restore_priority(
@@ -324,7 +324,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Seize(
 {
   Status_Control status;
   const Scheduler_Control *scheduler = _Scheduler_Get_own( executing );
-  Priority_Control initial_priority = executing->current_priority;
+  Priority_Control initial_priority = _Thread_Get_priority( executing );
   Priority_Control ceiling_priority = _MRSP_Get_priority( mrsp, scheduler );
   bool priority_ok = !_Thread_Priority_less_than(
     ceiling_priority,
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index b73a1b2..85951fa 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -46,7 +46,8 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
   const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
   const Thread_Control *thread_next = (const Thread_Control *) next;
 
-  return thread_to_insert->current_priority <= thread_next->current_priority;
+  return _Thread_Get_priority( thread_to_insert )
+    <= _Thread_Get_priority( thread_next );
 }
 
 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
@@ -57,7 +58,8 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
   const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
   const Thread_Control *thread_next = (const Thread_Control *) next;
 
-  return thread_to_insert->current_priority < thread_next->current_priority;
+  return _Thread_Get_priority( thread_to_insert )
+    < _Thread_Get_priority( thread_next );
 }
 
 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 30f903f..12f78b0 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -930,6 +930,24 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
 }
 
 /**
+ * @brief Returns the priority of the thread.
+ *
+ * Returns the user API and thread wait information relevant thread priority.
+ * This includes temporary thread priority adjustments due to locking
+ * protocols, a job release or the POSIX sporadic server for example.
+ *
+ * @return The priority of the thread.
+ *
+ * @see _Scheduler_Node_get_priority().
+ */
+RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(
+  const Thread_Control *the_thread
+)
+{
+  return the_thread->current_priority;
+}
+
+/**
  * @brief Acquires the thread wait default lock inside a critical section
  * (interrupts disabled).
  *
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 87d90a6..315b33d 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -240,7 +240,7 @@ Status_Control _MPCI_Send_request_packet(
     executing = _Per_CPU_Get_executing( cpu_self );
 
     the_packet->source_tid      = executing->Object.id;
-    the_packet->source_priority = executing->current_priority;
+    the_packet->source_priority = _Thread_Get_priority( executing );
     the_packet->to_convert =
        ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
 
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 70db651..0c1e48e 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -61,8 +61,10 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
       the_thread->real_priority = priority;
 
       if (
-        _Thread_Priority_less_than( the_thread->current_priority, priority )
-          || !_Thread_Owns_resources( the_thread )
+        _Thread_Priority_less_than(
+          _Thread_Get_priority( the_thread ),
+          priority
+        ) || !_Thread_Owns_resources( the_thread )
       ) {
         the_thread->current_priority = priority;
       }
@@ -84,7 +86,7 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
    *    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 ( priority < _Thread_Heir->current_priority ) {
+  if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
     _Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR );
   }
 
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 0fbf0f0..4c74c48 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -32,7 +32,7 @@ static bool _Scheduler_EDF_Release_job_filter(
 
   node = _Scheduler_EDF_Thread_get_node( the_thread );
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   new_priority = *new_priority_p;
 
   node->current_priority = new_priority;
@@ -69,7 +69,7 @@ static bool _Scheduler_EDF_Cancel_job_filter(
 
   node = _Scheduler_EDF_Thread_get_node( the_thread );
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   new_priority = node->background_priority;
 
   node->current_priority = new_priority;
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 0f04cb3..9b156ec 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -52,7 +52,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
    *    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 ( priority < _Thread_Heir->current_priority ) {
+  if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
     _Scheduler_Update_heir(
       the_thread,
       priority == ( SCHEDULER_EDF_PRIO_MSB | PRIORITY_PSEUDO_ISR )
diff --git a/cpukit/score/src/schedulerpriorityunblock.c b/cpukit/score/src/schedulerpriorityunblock.c
index 9fc266b..7186103 100644
--- a/cpukit/score/src/schedulerpriorityunblock.c
+++ b/cpukit/score/src/schedulerpriorityunblock.c
@@ -67,7 +67,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock (
    *    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 ( priority < _Thread_Heir->current_priority ) {
+  if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
     _Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR );
   }
 
diff --git a/cpukit/score/src/schedulersimpleunblock.c b/cpukit/score/src/schedulersimpleunblock.c
index a020f74..de08fc1 100644
--- a/cpukit/score/src/schedulersimpleunblock.c
+++ b/cpukit/score/src/schedulersimpleunblock.c
@@ -26,10 +26,12 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
   Thread_Control          *the_thread
 )
 {
-  Scheduler_simple_Context *context =
-    _Scheduler_simple_Get_context( scheduler );
+  Scheduler_simple_Context *context;
+  Priority_Control          priority;
 
+  context = _Scheduler_simple_Get_context( scheduler );
   _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
+  priority = _Thread_Get_priority( the_thread );
 
   /*
    *  If the thread that was unblocked is more important than the heir,
@@ -43,10 +45,10 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
    *    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 ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
     _Scheduler_Update_heir(
       the_thread,
-      the_thread->current_priority == PRIORITY_PSEUDO_ISR
+      priority == PRIORITY_PSEUDO_ISR
     );
   }
 
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index 97e7950..3429e1a 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -120,7 +120,7 @@ static bool _Thread_Raise_priority_filter(
 )
 {
   return _Thread_Priority_less_than(
-    the_thread->current_priority,
+    _Thread_Get_priority( the_thread ),
     *new_priority
   );
 }
@@ -149,7 +149,7 @@ static bool _Thread_Restore_priority_filter(
 
   the_thread->priority_restore_hint = false;
 
-  return *new_priority != the_thread->current_priority;
+  return *new_priority != _Thread_Get_priority( the_thread );
 }
 
 void _Thread_Restore_priority( Thread_Control *the_thread )
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index b72421e..cb4bfae 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -229,7 +229,7 @@ static bool _Thread_queue_Priority_less(
   scheduler_node = SCHEDULER_NODE_OF_WAIT_RBTREE_NODE( right );
   the_right = _Scheduler_Node_get_owner( scheduler_node );
 
-  return *the_left < the_right->current_priority;
+  return *the_left < _Thread_Get_priority( the_right );
 }
 
 static void _Thread_queue_Priority_priority_change(
@@ -300,7 +300,7 @@ static void _Thread_queue_Priority_do_enqueue(
 #endif
 
   scheduler_node = _Scheduler_Thread_get_own_node( the_thread );
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
 
   _RBTree_Initialize_node( &scheduler_node->Wait.Node.RBTree );
   _RBTree_Insert_inline(
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index e963c73..1498827 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -62,7 +62,7 @@ static bool _Thread_Raise_real_priority_filter(
 
   real_priority = the_thread->real_priority;
   new_priority = *new_priority_ptr;
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
 
   new_priority = _Thread_Priority_highest( real_priority, new_priority );
   *new_priority_ptr = new_priority;
@@ -507,7 +507,7 @@ void _Thread_Cancel(
   );
 
   cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
-  priority = executing->current_priority;
+  priority = _Thread_Get_priority( executing );
 
   if ( _States_Is_dormant( the_thread->current_state ) ) {
     _Thread_State_release( the_thread, &lock_context );
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index f6a061a..d6b8319 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -30,7 +30,7 @@ static bool _Thread_Set_priority_filter(
   Priority_Control  new_priority;
   Priority_Control *old_priority_ptr;
 
-  current_priority = the_thread->current_priority;
+  current_priority = _Thread_Get_priority( the_thread );
   new_priority = *new_priority_ptr;
 
   old_priority_ptr = arg;
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c
index b7a76a9..c114eb9 100644
--- a/testsuites/smptests/smpscheduler03/init.c
+++ b/testsuites/smptests/smpscheduler03/init.c
@@ -46,7 +46,7 @@ static bool change_priority_filter(
   void             *arg
 )
 {
-  return thread->current_priority != *new_priority;
+  return _Thread_Get_priority( thread ) != *new_priority;
 }
 
 static void change_priority(
diff --git a/testsuites/sptests/sp34/changepri.c b/testsuites/sptests/sp34/changepri.c
index f32f6ec..5000f69 100644
--- a/testsuites/sptests/sp34/changepri.c
+++ b/testsuites/sptests/sp34/changepri.c
@@ -29,6 +29,8 @@
 #include <stdio.h>
 #include "tmacros.h"
 
+#include <rtems/score/threadimpl.h>
+
 const char rtems_test_name[] = "SP 34";
 
 rtems_task BlockingTasks(rtems_task_argument arg);
@@ -44,7 +46,7 @@ const char *CallerName(void)
   Thread_Control *executing = _Thread_Get_executing();
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), executing->current_priority );
+      rtems_task_self(), _Thread_Get_priority( executing ) );
 #else
   volatile union {
     uint32_t u;
@@ -58,7 +60,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],
-      executing->current_priority
+      _Thread_Get_priority( executing )
   );
 #endif
   return buffer;
diff --git a/testsuites/sptests/sp35/priinv.c b/testsuites/sptests/sp35/priinv.c
index c7eb336..b191bf3 100644
--- a/testsuites/sptests/sp35/priinv.c
+++ b/testsuites/sptests/sp35/priinv.c
@@ -58,6 +58,8 @@
 #include <stdio.h>
 #include "tmacros.h"
 
+#include <rtems/score/threadimpl.h>
+
 const char rtems_test_name[] = "SP 35";
 
 #if defined(TEST_EXIT_AFTER_ITERATIONS)
@@ -86,7 +88,7 @@ const char *CallerName(void)
   Thread_Control *executing = _Thread_Get_executing();
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), executing->current_priority );
+      rtems_task_self(), _Thread_Get_priority( executing ) );
 #else
   volatile union {
     uint32_t u;
@@ -100,7 +102,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],
-      executing->current_priority
+      _Thread_Get_priority( executing )
   );
 #endif
   return buffer;
@@ -255,7 +257,7 @@ void AccessLocalHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  EnterPrio = _Thread_Executing->current_priority;
+  EnterPrio = _Thread_Get_priority( _Thread_Executing );
   EnterCnt  = _Thread_Executing->resource_count;
 #endif
 
@@ -275,7 +277,7 @@ void AccessLocalHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  AccessPrio = _Thread_Executing->current_priority;
+  AccessPrio = _Thread_Get_priority( _Thread_Executing );
   AccessCnt  = _Thread_Executing->resource_count;
 #endif
 
@@ -284,7 +286,7 @@ void AccessLocalHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  LeavePrio = _Thread_Executing->current_priority;
+  LeavePrio = _Thread_Get_priority( _Thread_Executing );
   LeaveCnt  = _Thread_Executing->resource_count;
 
   printf(
@@ -321,7 +323,7 @@ void AccessRemoteHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  EnterPrio = _Thread_Executing->current_priority;
+  EnterPrio = _Thread_Get_priority( _Thread_Executing );
   EnterCnt  = _Thread_Executing->resource_count;
 #endif
 
@@ -340,7 +342,7 @@ void AccessRemoteHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  AccessPrio = _Thread_Executing->current_priority;
+  AccessPrio = _Thread_Get_priority( _Thread_Executing );
   AccessCnt  = _Thread_Executing->resource_count;
 #endif
 
@@ -349,7 +351,7 @@ void AccessRemoteHw(void)
 
 #if defined(TEST_PRINT_STATISTICS)
   /* Store information about the current situation */
-  LeavePrio = _Thread_Executing->current_priority;
+  LeavePrio = _Thread_Get_priority( _Thread_Executing );
   LeaveCnt  = _Thread_Executing->resource_count;
 
   printf(
-- 
1.8.4.5




More information about the devel mailing list