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/itron | |
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 'cpukit/itron')
-rw-r--r-- | cpukit/itron/inline/rtems/itron/semaphore.inl | 2 | ||||
-rw-r--r-- | cpukit/itron/src/twai_sem.c | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/cpukit/itron/inline/rtems/itron/semaphore.inl b/cpukit/itron/inline/rtems/itron/semaphore.inl index c57347f319..1822fb8884 100644 --- a/cpukit/itron/inline/rtems/itron/semaphore.inl +++ b/cpukit/itron/inline/rtems/itron/semaphore.inl @@ -172,6 +172,8 @@ RTEMS_INLINE_ROUTINE ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( return E_TMOUT; case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: return E_QOVR; + case CORE_SEMAPHORE_BAD_TIMEOUT_VALUE: + return E_PAR; case THREAD_STATUS_PROXY_BLOCKING: return THREAD_STATUS_PROXY_BLOCKING; } diff --git a/cpukit/itron/src/twai_sem.c b/cpukit/itron/src/twai_sem.c index 133d0647be..90b3121051 100644 --- a/cpukit/itron/src/twai_sem.c +++ b/cpukit/itron/src/twai_sem.c @@ -30,23 +30,23 @@ ER twai_sem( TMO tmout ) { - ITRON_Semaphore_Control *the_semaphore; - Objects_Locations location; - Watchdog_Interval interval; - boolean wait; - CORE_semaphore_Status status; + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + Watchdog_Interval interval; + Core_semaphore_Blocking_option blocking; interval = 0; if ( tmout == TMO_POL ) { - wait = FALSE; + blocking = CORE_SEMAPHORE_NO_WAIT; } else { - wait = TRUE; + blocking = CORE_SEMAPHORE_BLOCK_FOREVER; + if ( tmout != TMO_FEVR ) interval = TOD_MILLISECONDS_TO_TICKS(tmout); - } - if ( wait && _ITRON_Is_in_non_task_state() ) - return E_CTX; + if ( _ITRON_Is_in_non_task_state() ) + return E_CTX; + } the_semaphore = _ITRON_Semaphore_Get( semid, &location ); switch ( location ) { @@ -58,12 +58,13 @@ ER twai_sem( _CORE_semaphore_Seize( &the_semaphore->semaphore, the_semaphore->Object.id, - wait, /* wait for a timeout */ + blocking, /* wait for a timeout */ interval /* timeout value */ ); _Thread_Enable_dispatch(); - status = (CORE_semaphore_Status) _Thread_Executing->Wait.return_code; - return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); + return _ITRON_Semaphore_Translate_core_semaphore_return_code( + _Thread_Executing->Wait.return_code + ); } return E_OK; } |