From 982e97463f66b09b79825c481f3b3f343ef361b8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 19 Jul 2013 15:00:11 +0200 Subject: 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. --- cpukit/posix/src/prwlocktrywrlock.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cpukit/posix/src/prwlocktrywrlock.c') 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) -- cgit v1.2.3