summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/prwlocktrywrlock.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/prwlocktrywrlock.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/prwlocktrywrlock.c')
-rw-r--r--cpukit/posix/src/prwlocktrywrlock.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/posix/src/prwlocktrywrlock.c b/cpukit/posix/src/prwlocktrywrlock.c
index 23259db34a..189983632c 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -43,6 +43,7 @@ int pthread_rwlock_trywrlock(
{
POSIX_RWLock_Control *the_rwlock;
Objects_Locations location;
+ Thread_Control *executing;
if ( !rwlock )
return EINVAL;
@@ -52,17 +53,19 @@ int pthread_rwlock_trywrlock(
case OBJECTS_LOCAL:
+ executing = _Thread_Executing;
_CORE_RWLock_Obtain_for_writing(
- &the_rwlock->RWLock,
- *rwlock,
- false, /* we are not willing to wait */
- 0,
- NULL
+ &the_rwlock->RWLock,
+ executing,
+ *rwlock,
+ false, /* we are not willing to wait */
+ 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)