summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/corerwlockobtainread.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-21 15:42:45 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-05 14:29:02 +0200
commit89fc9345dea5c675f8d93546fa3c723918d3279a (patch)
tree89c32d64f375e1a9bf9d3725b1256aeb7ca46221 /cpukit/score/src/corerwlockobtainread.c
parentposix: Implement self-contained POSIX barriers (diff)
downloadrtems-89fc9345dea5c675f8d93546fa3c723918d3279a.tar.bz2
posix: Implement self-contained POSIX rwlocks
POSIX rwlocks are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3115.
Diffstat (limited to 'cpukit/score/src/corerwlockobtainread.c')
-rw-r--r--cpukit/score/src/corerwlockobtainread.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c
index 641945635f..d0bd7b09ce 100644
--- a/cpukit/score/src/corerwlockobtainread.c
+++ b/cpukit/score/src/corerwlockobtainread.c
@@ -26,18 +26,19 @@
Status_Control _CORE_RWLock_Seize_for_reading(
CORE_RWLock_Control *the_rwlock,
- Thread_Control *executing,
bool wait,
Thread_queue_Context *queue_context
)
{
+ Thread_Control *executing;
+
/*
* If unlocked, then OK to read.
* If locked for reading and no waiters, then OK to read.
* If any thread is waiting, then we wait.
*/
- _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
+ executing = _CORE_RWLock_Acquire( the_rwlock, queue_context );
switch ( the_rwlock->current_state ) {
case CORE_RWLOCK_UNLOCKED:
@@ -46,19 +47,13 @@ Status_Control _CORE_RWLock_Seize_for_reading(
_CORE_RWLock_Release( the_rwlock, queue_context );
return STATUS_SUCCESSFUL;
- case CORE_RWLOCK_LOCKED_FOR_READING: {
- Thread_Control *waiter;
- waiter = _Thread_queue_First_locked(
- &the_rwlock->Wait_queue,
- CORE_RWLOCK_TQ_OPERATIONS
- );
- if ( !waiter ) {
+ case CORE_RWLOCK_LOCKED_FOR_READING:
+ if ( _Thread_queue_Is_empty( &the_rwlock->Queue.Queue ) ) {
the_rwlock->number_of_readers += 1;
_CORE_RWLock_Release( the_rwlock, queue_context );
return STATUS_SUCCESSFUL;
}
break;
- }
case CORE_RWLOCK_LOCKED_FOR_WRITING:
break;
}
@@ -84,7 +79,7 @@ Status_Control _CORE_RWLock_Seize_for_reading(
);
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue(
- &the_rwlock->Wait_queue.Queue,
+ &the_rwlock->Queue.Queue,
CORE_RWLOCK_TQ_OPERATIONS,
executing,
queue_context