diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-23 13:37:59 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-26 21:44:31 +0200 |
commit | dce487912d98835b8168e755b60514f5a8592b27 (patch) | |
tree | 8778547fbb0f2dbb07bb6a83f28d3f4464924141 /cpukit/score/include/rtems/score/corerwlockimpl.h | |
parent | posix: Fix sem_init() with too large initial value (diff) | |
download | rtems-dce487912d98835b8168e755b60514f5a8592b27.tar.bz2 |
score: Add Status_Control for all APIs
Unify the status codes of the Classic and POSIX API to use the new enum
Status_Control. This eliminates the Thread_Control::Wait::timeout_code
field and the timeout parameter of _Thread_queue_Enqueue_critical() and
_MPCI_Send_request_packet(). It gets rid of the status code translation
tables and instead uses simple bit operations to get the status for a
particular API. This enables translation of status code constants at
compile time. Add _Thread_Wait_get_status() to avoid direct access of
thread internal data structures.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/include/rtems/score/corerwlockimpl.h | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h b/cpukit/score/include/rtems/score/corerwlockimpl.h index 67084c136a..e80ab0ef0c 100644 --- a/cpukit/score/include/rtems/score/corerwlockimpl.h +++ b/cpukit/score/include/rtems/score/corerwlockimpl.h @@ -22,6 +22,7 @@ #include <rtems/score/corerwlock.h> #include <rtems/score/thread.h> #include <rtems/score/threadqimpl.h> +#include <rtems/score/status.h> #include <rtems/score/watchdog.h> #ifdef __cplusplus @@ -36,27 +37,6 @@ extern "C" { #define CORE_RWLOCK_TQ_OPERATIONS &_Thread_queue_Operations_FIFO /** - * Core RWLock handler return statuses. - */ -typedef enum { - /** This status indicates that the operation completed successfully. */ - CORE_RWLOCK_SUCCESSFUL, - /** This status indicates that the thread was blocked waiting for an */ - CORE_RWLOCK_WAS_DELETED, - /** This status indicates that the rwlock was not immediately available. */ - CORE_RWLOCK_UNAVAILABLE, - /** This status indicates that the calling task was willing to block - * but the operation was unable to complete within the time allotted - * because the resource never became available. - */ - CORE_RWLOCK_TIMEOUT -} CORE_RWLock_Status; - -/** This is the last status value. - */ -#define CORE_RWLOCK_STATUS_LAST CORE_RWLOCK_TIMEOUT - -/** * This is used to denote that a thread is blocking waiting for * read-only access to the RWLock. */ @@ -117,11 +97,9 @@ RTEMS_INLINE_ROUTINE void _CORE_RWLock_Release( * @param[in] wait is true if the calling thread is willing to wait * @param[in] timeout is the number of ticks the calling thread is willing * to wait if @a wait is true. - * - * @note Status is returned via the thread control block. */ -void _CORE_RWLock_Seize_for_reading( +Status_Control _CORE_RWLock_Seize_for_reading( CORE_RWLock_Control *the_rwlock, Thread_Control *executing, bool wait, @@ -138,10 +116,8 @@ void _CORE_RWLock_Seize_for_reading( * @param[in] wait is true if the calling thread is willing to wait * @param[in] timeout is the number of ticks the calling thread is willing * to wait if @a wait is true. - * - * @note Status is returned via the thread control block. */ -void _CORE_RWLock_Seize_for_writing( +Status_Control _CORE_RWLock_Seize_for_writing( CORE_RWLock_Control *the_rwlock, Thread_Control *executing, bool wait, @@ -159,7 +135,7 @@ void _CORE_RWLock_Seize_for_writing( * * @retval Status is returned to indicate successful or failure. */ -CORE_RWLock_Status _CORE_RWLock_Surrender( +Status_Control _CORE_RWLock_Surrender( CORE_RWLock_Control *the_rwlock, Thread_queue_Context *queue_context ); |