[rtems commit] Use _Thread_Dispatch_direct()

Sebastian Huber sebh at rtems.org
Thu Feb 8 12:38:13 UTC 2018


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Feb  8 10:47:16 2018 +0100

Use _Thread_Dispatch_direct()

Use _Thread_Dispatch_direct() for operations that block the executing
thread.  This ensures that we get a fatal error
(INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL) if we try to block in
an invalid context, e.g. during system start or an interrupt handler.

---

 cpukit/posix/src/pthreadexit.c   | 2 +-
 cpukit/posix/src/pthreadjoin.c   | 2 +-
 cpukit/rtems/src/eventseize.c    | 2 +-
 cpukit/rtems/src/ratemonperiod.c | 4 ++--
 cpukit/rtems/src/taskmode.c      | 2 +-
 cpukit/rtems/src/taskwakewhen.c  | 2 +-
 cpukit/score/src/threadrestart.c | 4 ++--
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c
index 53c42ff..1d041bf 100644
--- a/cpukit/posix/src/pthreadexit.c
+++ b/cpukit/posix/src/pthreadexit.c
@@ -34,6 +34,6 @@ void pthread_exit( void *value_ptr )
 
   _Thread_Exit( executing, THREAD_LIFE_TERMINATING, value_ptr );
 
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
   RTEMS_UNREACHABLE();
 }
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index ce4bf0d..3fc52d7 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -72,7 +72,7 @@ static int _POSIX_Threads_Join( pthread_t thread, void **value_ptr )
       &queue_context.Lock_context.Lock_context
     );
     _Thread_State_release( the_thread, &queue_context.Lock_context.Lock_context );
-    _Thread_Dispatch_enable( cpu_self );
+    _Thread_Dispatch_direct( cpu_self );
   } else {
     _Thread_Join(
       the_thread,
diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c
index c6bd418..0d60979 100644
--- a/cpukit/rtems/src/eventseize.c
+++ b/cpukit/rtems/src/eventseize.c
@@ -96,7 +96,7 @@ rtems_status_code _Event_Seize(
     _Thread_Unblock( executing );
   }
 
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
   return _Status_Get_after_wait( executing );
 }
 
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 2e4e482..b266920 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -85,7 +85,7 @@ static void _Rate_monotonic_Release_postponed_job(
   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
   _Rate_monotonic_Release( the_period, lock_context );
   _Thread_Priority_update( &queue_context );
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
 }
 
 static void _Rate_monotonic_Release_job(
@@ -263,7 +263,7 @@ static rtems_status_code _Rate_monotonic_Block_while_active(
     _Thread_Unblock( executing );
   }
 
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
   return RTEMS_SUCCESSFUL;
 }
 
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index f25746e..e16faa5 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -143,7 +143,7 @@ rtems_status_code rtems_task_mode(
     _Thread_State_acquire( executing, &lock_context );
     _Scheduler_Schedule( executing );
     _Thread_State_release( executing, &lock_context );
-    _Thread_Dispatch_enable( cpu_self );
+    _Thread_Dispatch_direct( cpu_self );
   }
 
   return RTEMS_SUCCESSFUL;
diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c
index 221a1b9..330d37a 100644
--- a/cpukit/rtems/src/taskwakewhen.c
+++ b/cpukit/rtems/src/taskwakewhen.c
@@ -58,6 +58,6 @@ rtems_status_code rtems_task_wake_when(
       _Thread_Timeout,
       _Watchdog_Ticks_from_seconds( seconds )
     );
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
   return RTEMS_SUCCESSFUL;
 }
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 0430ca0..ae5c338 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -300,7 +300,7 @@ static Per_CPU_Control *_Thread_Wait_for_join(
   ) {
     _Thread_Set_state_locked( executing, STATES_WAITING_FOR_JOIN_AT_EXIT );
     _Thread_State_release( executing, &lock_context );
-    _Thread_Dispatch_enable( cpu_self );
+    _Thread_Dispatch_direct( cpu_self );
 
     /* Let other threads run */
 
@@ -660,7 +660,7 @@ void _Thread_Restart_self(
   _Thread_Wait_release_default( executing, lock_context );
 
   _Thread_Priority_update( &queue_context );
-  _Thread_Dispatch_enable( cpu_self );
+  _Thread_Dispatch_direct( cpu_self );
   RTEMS_UNREACHABLE();
 }
 



More information about the vc mailing list