summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/coresem.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-07-18 18:45:56 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-07-18 18:45:56 +0000
commit6a0898bba30ccd936e0ac1d6268970316efe92c4 (patch)
tree364d967bdfcdb75695666e37263cb2f0bed3a077 /cpukit/score/include/rtems/score/coresem.h
parentChanged special purpose register inline functions to macros. (diff)
downloadrtems-6a0898bba30ccd936e0ac1d6268970316efe92c4.tar.bz2
2008-07-18 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1291/cpukit * itron/inline/rtems/itron/semaphore.inl, itron/src/twai_sem.c, posix/include/mqueue.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/include/rtems/posix/time.h, posix/src/condtimedwait.c, posix/src/mqueuereceive.c, posix/src/mqueuerecvsupp.c, posix/src/mqueuesend.c, posix/src/mqueuesendsupp.c, posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/mutextranslatereturncode.c, posix/src/posixtimespecabsolutetimeout.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/semaphoretranslatereturncode.c, posix/src/semaphorewaitsupp.c, posix/src/semtimedwait.c, posix/src/semtrywait.c, posix/src/semwait.c, posix/src/sigtimedwait.c, posix/src/timersettime.c, posix/src/ualarm.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/src/coresemseize.c: This patch addresses issues on implementation of the timeout on the following POSIX services. Some of these services incorrectly took a timeout as a relative time. Others would compute a 0 delta to timeout if the absolute time and the current time were equal and thus incorrectly block the caller forever. The root of the confusion is that POSIX specifies that if the timeout is incorrect (e.g. in the past, is now, or is numerically invalid), that it does not matter if the call would succeed without blocking. This is in contrast to RTEMS programming style where all errors are checked before any critical sections are entered. This fix implemented a more uniform way of handling POSIX absolute time timeouts. + pthread_cond_timedwait - could block forever + mq_timedreceive - used relative not absolute time + mq_timedsend - used relative not absolute time + pthread_mutex_timedlock - used relative not absolute time + pthread_rwlock_timedrdlock- used relative not absolute time + pthread_rwlock_timedwrlock- used relative not absolute time + sem_timedwait - could block forever
Diffstat (limited to 'cpukit/score/include/rtems/score/coresem.h')
-rw-r--r--cpukit/score/include/rtems/score/coresem.h42
1 files changed, 8 insertions, 34 deletions
diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h
index 9a0436b29a..fc2f979ff5 100644
--- a/cpukit/score/include/rtems/score/coresem.h
+++ b/cpukit/score/include/rtems/score/coresem.h
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -82,14 +82,7 @@ typedef enum {
/** This status indicates that an attempt was made to unlock the semaphore
* and this would have made its count greater than that allowed.
*/
- CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED,
- /** This status indicates that the semaphore was not immediately
- * available and the caller passed a bad timeout value to the API
- * routine. In this case, the API required that the validity check
- * for the timeout occur after the check that the semaphore was immediately
- * available.
- */
- CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
+ CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
} CORE_semaphore_Status;
/**
@@ -97,7 +90,7 @@ typedef enum {
*
* This is the last status value.
*/
-#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
+#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
/**
* The following defines the control block used to manage the
@@ -130,25 +123,6 @@ typedef struct {
} CORE_semaphore_Control;
/**
- * The following enumerated type is the set of blocking options
- * available to seize operation.
- */
-typedef enum {
- /** This value indicates that the caller does not wish to block. */
- CORE_SEMAPHORE_NO_WAIT,
- /** This value indicates that the caller is willing to block forever. */
- CORE_SEMAPHORE_BLOCK_FOREVER,
- /** This value indicates that the caller is blocking with a timeout. */
- CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT,
- /** This value indicates that the caller wanted to block but passed in
- * a bad timeout value to the API. Unfortunately, this is a weird case
- * where the timeout bad error is required to be generated only if
- * the semaphore is not available.
- */
- CORE_SEMAPHORE_BAD_TIMEOUT
-} Core_semaphore_Blocking_option;
-
-/**
* This routine initializes the semaphore based on the parameters passed.
*
* @param[in] the_semaphore is the semaphore to initialize
@@ -170,15 +144,15 @@ void _CORE_semaphore_Initialize(
* @param[in] the_semaphore is the semaphore to seize
* @param[in] id is the Id of the API level Semaphore object associated
* with this instance of a SuperCore Semaphore
- * @param[in] wait is the blocking mode
+ * @param[in] wait indicates if the caller is willing to block
* @param[in] timeout is the number of ticks the calling thread is willing
* to wait if @a wait is TRUE.
*/
void _CORE_semaphore_Seize(
- CORE_semaphore_Control *the_semaphore,
- Objects_Id id,
- Core_semaphore_Blocking_option wait,
- Watchdog_Interval timeout
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
);
/**