[PATCH 07/12] rtems: Simplify rtems_semaphore_flush()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri May 27 13:50:36 UTC 2016


Due to the unified status codes, we can now use a common flush method
for semaphore and mutex variants.
---
 cpukit/rtems/src/semflush.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index 2410ed2..0db8c34 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -55,21 +55,16 @@ rtems_status_code rtems_semaphore_flush( rtems_id id )
       );
       return RTEMS_NOT_DEFINED;
 #endif
-    case SEMAPHORE_VARIANT_MUTEX:
-      _CORE_mutex_Flush(
-        &the_semaphore->Core_control.mutex,
-        _Thread_queue_Flush_status_unavailable,
-        &queue_context
-      );
-      break;
     default:
       _Assert(
-        the_semaphore->variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
+        the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX
+          || the_semaphore->variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
           || the_semaphore->variant == SEMAPHORE_VARIANT_COUNTING
       );
-      _CORE_semaphore_Flush(
-        &the_semaphore->Core_control.semaphore,
+      _Thread_queue_Flush_critical(
+        &the_semaphore->Core_control.Wait_queue.Queue,
         _Semaphore_Get_operations( the_semaphore ),
+        _Thread_queue_Flush_status_unavailable,
         &queue_context
       );
       break;
-- 
1.8.4.5




More information about the devel mailing list