From 0c2ec7f52c496e436f09d44dcb880bf4ea16ba86 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 30 Oct 2006 22:21:23 +0000 Subject: 2006-10-30 Joel Sherrill PR 841/rtems * itron/inline/rtems/itron/semaphore.inl, itron/src/twai_sem.c, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/semaphore.inl, posix/src/semaphorewaitsupp.c, posix/src/semtimedwait.c, posix/src/semwait.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, score/include/rtems/score/coresem.h, score/src/coresemseize.c: Make sem_timedwait more conformant to Open Group specification. --- cpukit/rtems/src/semobtain.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'cpukit/rtems/src/semobtain.c') diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c index 72ac454de5..bfa8831f6a 100644 --- a/cpukit/rtems/src/semobtain.c +++ b/cpukit/rtems/src/semobtain.c @@ -71,10 +71,9 @@ rtems_status_code rtems_semaphore_obtain( rtems_interval timeout ) { - register Semaphore_Control *the_semaphore; - Objects_Locations location; - boolean wait; - ISR_Level level; + register Semaphore_Control *the_semaphore; + Objects_Locations location; + ISR_Level level; the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level ); switch ( location ) { @@ -92,16 +91,11 @@ rtems_status_code rtems_semaphore_obtain( return RTEMS_INVALID_ID; case OBJECTS_LOCAL: - if ( _Options_Is_no_wait( option_set ) ) - wait = FALSE; - else - wait = TRUE; - if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) { _CORE_mutex_Seize( &the_semaphore->Core_control.mutex, id, - wait, + ((_Options_Is_no_wait( option_set )) ? FALSE : TRUE), timeout, level ); @@ -113,7 +107,8 @@ rtems_status_code rtems_semaphore_obtain( _CORE_semaphore_Seize_isr_disable( &the_semaphore->Core_control.semaphore, id, - wait, + ((_Options_Is_no_wait( option_set )) ? + CORE_SEMAPHORE_NO_WAIT : CORE_SEMAPHORE_BLOCK_FOREVER), timeout, &level ); -- cgit v1.2.3