diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-19 15:00:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:57:23 +0200 |
commit | 982e97463f66b09b79825c481f3b3f343ef361b8 (patch) | |
tree | bf7d0a227442d89b4ac851227d7d9db344678932 /cpukit/posix/src/prwlockrdlock.c | |
parent | score: Create rwlock implementation header (diff) | |
download | rtems-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/prwlockrdlock.c')
-rw-r--r-- | cpukit/posix/src/prwlockrdlock.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c index 3d4d76fab7..e045b07679 100644 --- a/cpukit/posix/src/prwlockrdlock.c +++ b/cpukit/posix/src/prwlockrdlock.c @@ -39,6 +39,7 @@ int pthread_rwlock_rdlock( { POSIX_RWLock_Control *the_rwlock; Objects_Locations location; + Thread_Control *executing; if ( !rwlock ) return EINVAL; @@ -48,17 +49,19 @@ int pthread_rwlock_rdlock( case OBJECTS_LOCAL: + executing = _Thread_Executing; _CORE_RWLock_Obtain_for_reading( - &the_rwlock->RWLock, - *rwlock, - true, /* we are willing to wait forever */ - 0, - NULL + &the_rwlock->RWLock, + executing, + *rwlock, + true, /* we are willing to wait forever */ + 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) |