[PATCH 08/12] rtems: Simplify rtems_semaphore_delete()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri May 27 13:50:37 UTC 2016
Due to the unified status codes, we can now use a common flush and
destroy method for semaphore and mutex variants.
---
cpukit/rtems/src/semdelete.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index 768e686..da563e5 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -85,14 +85,6 @@ rtems_status_code rtems_semaphore_delete(
_Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
switch ( the_semaphore->variant ) {
- case SEMAPHORE_VARIANT_MUTEX:
- _CORE_mutex_Flush(
- &the_semaphore->Core_control.mutex,
- _Thread_queue_Flush_status_object_was_deleted,
- &queue_context
- );
- _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
- break;
#if defined(RTEMS_SMP)
case SEMAPHORE_VARIANT_MRSP:
_MRSP_Destroy( &the_semaphore->Core_control.mrsp, &queue_context );
@@ -100,14 +92,17 @@ rtems_status_code rtems_semaphore_delete(
#endif
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_Destroy(
- &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_object_was_deleted,
&queue_context
);
+ _Thread_queue_Destroy( &the_semaphore->Core_control.Wait_queue );
break;
}
--
1.8.4.5
More information about the devel
mailing list