summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/semrelease.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 21:39:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-30 16:16:21 +0200
commit2581a563f9182dc2debdba97f33feee6d797e53a (patch)
tree97883371771f9a2905d159d8e11c0b2e9da0408c /cpukit/rtems/src/semrelease.c
parentrtems: Simplify rtems_semaphore_delete() (diff)
downloadrtems-2581a563f9182dc2debdba97f33feee6d797e53a.tar.bz2
score: Add semaphore variants
Diffstat (limited to 'cpukit/rtems/src/semrelease.c')
-rw-r--r--cpukit/rtems/src/semrelease.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c
index 10fe743480..d18901a40c 100644
--- a/cpukit/rtems/src/semrelease.c
+++ b/cpukit/rtems/src/semrelease.c
@@ -22,14 +22,12 @@
#endif
#include <rtems/rtems/semimpl.h>
-#include <rtems/rtems/attrimpl.h>
#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_semaphore_release( rtems_id id )
{
Semaphore_Control *the_semaphore;
Thread_queue_Context queue_context;
- rtems_attribute attribute_set;
Status_Control status;
the_semaphore = _Semaphore_Get( id, &queue_context );
@@ -47,27 +45,31 @@ rtems_status_code rtems_semaphore_release( rtems_id id )
_Semaphore_Core_mutex_mp_support
);
- attribute_set = the_semaphore->attribute_set;
+ switch ( the_semaphore->variant ) {
#if defined(RTEMS_SMP)
- if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
- status = _MRSP_Surrender(
- &the_semaphore->Core_control.mrsp,
- _Thread_Executing,
- &queue_context
- );
- } else
+ case SEMAPHORE_VARIANT_MRSP:
+ status = _MRSP_Surrender(
+ &the_semaphore->Core_control.mrsp,
+ _Thread_Executing,
+ &queue_context
+ );
+ break;
#endif
- if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
- status = _CORE_mutex_Surrender(
- &the_semaphore->Core_control.mutex,
- &queue_context
- );
- } else {
- status = _CORE_semaphore_Surrender(
- &the_semaphore->Core_control.semaphore,
- UINT32_MAX,
- &queue_context
- );
+ case SEMAPHORE_VARIANT_MUTEX:
+ status = _CORE_mutex_Surrender(
+ &the_semaphore->Core_control.mutex,
+ &queue_context
+ );
+ break;
+ default:
+ _Assert( the_semaphore->variant == SEMAPHORE_VARIANT_COUNTING );
+ status = _CORE_semaphore_Surrender(
+ &the_semaphore->Core_control.semaphore,
+ _Semaphore_Get_operations( the_semaphore ),
+ UINT32_MAX,
+ &queue_context
+ );
+ break;
}
return _Status_Get( status );