diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2006-10-30 22:21:23 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2006-10-30 22:21:23 +0000 |
commit | 0c2ec7f52c496e436f09d44dcb880bf4ea16ba86 (patch) | |
tree | a9b300a256bb640e1abfdc6dbbb6eac0a49c6a96 /cpukit/score/src/coresemseize.c | |
parent | 2006-10-30 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-0c2ec7f52c496e436f09d44dcb880bf4ea16ba86.tar.bz2 |
2006-10-30 Joel Sherrill <joel@OARcorp.com>
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.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/coresemseize.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/cpukit/score/src/coresemseize.c b/cpukit/score/src/coresemseize.c index 49c835b80b..2648a620c2 100644 --- a/cpukit/score/src/coresemseize.c +++ b/cpukit/score/src/coresemseize.c @@ -51,10 +51,10 @@ */ void _CORE_semaphore_Seize( - CORE_semaphore_Control *the_semaphore, - Objects_Id id, - boolean wait, - Watchdog_Interval timeout + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + Core_semaphore_Blocking_option wait, + Watchdog_Interval timeout ) { Thread_Control *executing; @@ -69,16 +69,22 @@ void _CORE_semaphore_Seize( return; } - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; - return; + switch ( wait ) { + case CORE_SEMAPHORE_NO_WAIT: + _ISR_Enable( level ); + executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; + return; + case CORE_SEMAPHORE_BAD_TIMEOUT: + executing->Wait.return_code = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE; + return; + case CORE_SEMAPHORE_BLOCK_FOREVER: + case CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT: + _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); + executing->Wait.queue = &the_semaphore->Wait_queue; + executing->Wait.id = id; + _ISR_Enable( level ); + _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); + break; } - _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); - executing->Wait.queue = &the_semaphore->Wait_queue; - executing->Wait.id = id; - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); } |