[PATCH 1/3] score: _Thread_blocking_operation_Is_critical()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Oct 16 14:45:27 UTC 2012


Add and use _Thread_blocking_operation_Is_critical().
---
 cpukit/rtems/src/eventsurrender.c          |    5 +----
 cpukit/score/inline/rtems/score/thread.inl |   12 ++++++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/cpukit/rtems/src/eventsurrender.c b/cpukit/rtems/src/eventsurrender.c
index 9761c78..2b48809 100644
--- a/cpukit/rtems/src/eventsurrender.c
+++ b/cpukit/rtems/src/eventsurrender.c
@@ -72,10 +72,7 @@ void _Event_Surrender(
    *  If we are in an ISR and sending to the current thread, then
    *  we have a critical section issue to deal with.
    */
-  if ( _ISR_Is_in_progress() &&
-       _Thread_Is_executing( the_thread ) &&
-       ((_Event_Sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) ||
-        (_Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED)) ) {
+  if ( _Thread_blocking_operation_Is_critical( the_thread, _Event_Sync_state ) ) {
     if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
       api->pending_events = _Event_sets_Clear( pending_events,seized_events );
       the_thread->Wait.count = 0;
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
index b280638..51017f0 100644
--- a/cpukit/score/inline/rtems/score/thread.inl
+++ b/cpukit/score/inline/rtems/score/thread.inl
@@ -23,6 +23,7 @@
 
 #include <rtems/score/sysstate.h>
 #include <rtems/score/context.h>
+#include <rtems/score/isr.h>
 
 /**
  *  @addtogroup ScoreThread 
@@ -373,6 +374,17 @@ RTEMS_INLINE_ROUTINE bool _Thread_Evaluate_is_dispatch_needed(
   return false;
 }
 
+RTEMS_INLINE_ROUTINE bool _Thread_blocking_operation_Is_critical(
+  const Thread_Control *thread,
+  Thread_blocking_operation_States state
+)
+{
+  return _ISR_Is_in_progress()
+    && _Thread_Is_executing( thread )
+    && (state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED
+      || state == THREAD_BLOCKING_OPERATION_TIMEOUT);
+}
+
 /**@}*/
 
 #endif
-- 
1.7.7




More information about the devel mailing list