summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/corerwlockobtainwrite.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 13:37:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-26 21:44:31 +0200
commitdce487912d98835b8168e755b60514f5a8592b27 (patch)
tree8778547fbb0f2dbb07bb6a83f28d3f4464924141 /cpukit/score/src/corerwlockobtainwrite.c
parentposix: Fix sem_init() with too large initial value (diff)
downloadrtems-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 'cpukit/score/src/corerwlockobtainwrite.c')
-rw-r--r--cpukit/score/src/corerwlockobtainwrite.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c
index a7d1bb1b6a..0536b8287f 100644
--- a/cpukit/score/src/corerwlockobtainwrite.c
+++ b/cpukit/score/src/corerwlockobtainwrite.c
@@ -19,11 +19,12 @@
#endif
#include <rtems/score/corerwlockimpl.h>
+#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/watchdog.h>
-void _CORE_RWLock_Seize_for_writing(
+Status_Control _CORE_RWLock_Seize_for_writing(
CORE_RWLock_Control *the_rwlock,
Thread_Control *executing,
bool wait,
@@ -44,8 +45,7 @@ void _CORE_RWLock_Seize_for_writing(
case CORE_RWLOCK_UNLOCKED:
the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
_CORE_RWLock_Release( the_rwlock, queue_context );
- executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
- return;
+ return STATUS_SUCCESSFUL;
case CORE_RWLOCK_LOCKED_FOR_READING:
case CORE_RWLOCK_LOCKED_FOR_WRITING:
@@ -58,16 +58,14 @@ void _CORE_RWLock_Seize_for_writing(
if ( !wait ) {
_CORE_RWLock_Release( the_rwlock, queue_context );
- executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
- return;
+ return STATUS_UNAVAILABLE;
}
/*
* We need to wait to enter this critical section
*/
- executing->Wait.option = CORE_RWLOCK_THREAD_WAITING_FOR_WRITE;
- executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
+ executing->Wait.option = CORE_RWLOCK_THREAD_WAITING_FOR_WRITE;
_Thread_queue_Enqueue_critical(
&the_rwlock->Wait_queue.Queue,
@@ -75,7 +73,7 @@ void _CORE_RWLock_Seize_for_writing(
executing,
STATES_WAITING_FOR_RWLOCK,
timeout,
- CORE_RWLOCK_TIMEOUT,
&queue_context->Lock_context
);
+ return _Thread_Wait_get_status( executing );
}