[PATCH 1/3] posix: Move POSIX_API_Control::thread

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Oct 17 10:11:53 UTC 2017


This member is only used by the sporadic server support.

Update #2514.
---
 cpukit/posix/include/rtems/posix/threadsup.h | 6 +++---
 cpukit/posix/src/pthread.c                   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
index cc250f7464..816ef566d8 100644
--- a/cpukit/posix/include/rtems/posix/threadsup.h
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -40,9 +40,6 @@ extern "C" {
  * each thread in a system with POSIX configured.
  */
 typedef struct {
-  /** Back pointer to thread of this POSIX API control. */
-  Thread_Control         *thread;
-
   /** Created with explicit or inherited scheduler. */
   bool created_with_explicit_scheduler;
 
@@ -56,6 +53,9 @@ typedef struct {
    * @brief Control block for the sporadic server scheduling policy.
    */
   struct {
+    /** The thread of this sporadic control block */
+    Thread_Control *thread;
+
     /**
      * @brief This is the timer which controls when the thread executes at high
      * and low priority when using the sporadic server scheduling policy.
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 9d1c1ad012..291b19532d 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -49,7 +49,7 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
   Thread_queue_Context  queue_context;
 
   api = RTEMS_CONTAINER_OF( watchdog, POSIX_API_Control, Sporadic.Timer );
-  the_thread = api->thread;
+  the_thread = api->Sporadic.thread;
 
   _Thread_queue_Context_initialize( &queue_context );
   _Thread_queue_Context_clear_priority_updates( &queue_context );
@@ -127,7 +127,6 @@ static bool _POSIX_Threads_Create_extension(
   api = created->API_Extensions[ THREAD_API_POSIX ];
 
   /* XXX check all fields are touched */
-  api->thread = created;
   api->schedparam.sched_priority = _POSIX_Priority_From_core(
     _Thread_Scheduler_get_home( created ),
     _Thread_Get_priority( created )
@@ -149,6 +148,7 @@ static bool _POSIX_Threads_Create_extension(
     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 );
   _Priority_Node_set_inactive( &api->Sporadic.Low_priority );
-- 
2.12.3



More information about the devel mailing list