[rtems commit] rtems: Simplify rtems_semaphore_obtain()

Sebastian Huber sebh at rtems.org
Thu May 22 05:51:52 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May 21 09:30:14 2014 +0200

rtems: Simplify rtems_semaphore_obtain()

---

 cpukit/rtems/src/semobtain.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 697dde8..c9433ca 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -41,18 +41,20 @@ rtems_status_code rtems_semaphore_obtain(
   Objects_Locations               location;
   ISR_Level                       level;
   Thread_Control                 *executing;
+  bool                            wait;
 
   the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level );
   switch ( location ) {
 
     case OBJECTS_LOCAL:
       executing = _Thread_Executing;
+      wait = !_Options_Is_no_wait( option_set );
       if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) {
         _CORE_mutex_Seize(
           &the_semaphore->Core_control.mutex,
           executing,
           id,
-          ((_Options_Is_no_wait( option_set )) ? false : true),
+          wait,
           timeout,
           level
         );
@@ -66,7 +68,7 @@ rtems_status_code rtems_semaphore_obtain(
         &the_semaphore->Core_control.semaphore,
         executing,
         id,
-        ((_Options_Is_no_wait( option_set )) ? false : true),
+        wait,
         timeout,
         level
       );




More information about the vc mailing list