summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/prwlocktryrdlock.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-19 15:00:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-22 16:57:23 +0200
commit982e97463f66b09b79825c481f3b3f343ef361b8 (patch)
treebf7d0a227442d89b4ac851227d7d9db344678932 /cpukit/posix/src/prwlocktryrdlock.c
parentscore: Create rwlock implementation header (diff)
downloadrtems-982e97463f66b09b79825c481f3b3f343ef361b8.tar.bz2
score: Avoid direct usage of _Thread_Executing
Pass the executing thread as a function parameter. Obtain the executing thread inside a thread dispatch critical section to avoid problems on SMP.
Diffstat (limited to 'cpukit/posix/src/prwlocktryrdlock.c')
-rw-r--r--cpukit/posix/src/prwlocktryrdlock.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/posix/src/prwlocktryrdlock.c b/cpukit/posix/src/prwlocktryrdlock.c
index c4cfd76108..d682802784 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -43,6 +43,7 @@ int pthread_rwlock_tryrdlock(
{
POSIX_RWLock_Control *the_rwlock;
Objects_Locations location;
+ Thread_Control *executing;
if ( !rwlock )
return EINVAL;
@@ -52,18 +53,20 @@ int pthread_rwlock_tryrdlock(
case OBJECTS_LOCAL:
+ executing = _Thread_Executing;
_CORE_RWLock_Obtain_for_reading(
- &the_rwlock->RWLock,
- *rwlock,
- false, /* do not wait for the rwlock */
- 0,
- NULL
+ &the_rwlock->RWLock,
+ executing,
+ *rwlock,
+ false, /* do not wait for the rwlock */
+ 0,
+ NULL
);
_Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code(
- (CORE_RWLock_Status) _Thread_Executing->Wait.return_code
+ (CORE_RWLock_Status) executing->Wait.return_code
);
#if defined(RTEMS_MULTIPROCESSING)