diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-18 14:27:30 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:56:58 +0200 |
commit | e36f2b8c914b73bacfc89b997f4a59d5387303ce (patch) | |
tree | 19f4c9e363b353ea441c2459e5b697d18c4c8c5e /cpukit/posix/src/semaphorewaitsupp.c | |
parent | score: Add const qualifier (diff) | |
download | rtems-e36f2b8c914b73bacfc89b997f4a59d5387303ce.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/semaphorewaitsupp.c')
-rw-r--r-- | cpukit/posix/src/semaphorewaitsupp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cpukit/posix/src/semaphorewaitsupp.c b/cpukit/posix/src/semaphorewaitsupp.c index 67ecb43858..a590537d10 100644 --- a/cpukit/posix/src/semaphorewaitsupp.c +++ b/cpukit/posix/src/semaphorewaitsupp.c @@ -40,25 +40,28 @@ int _POSIX_Semaphore_Wait_support( { POSIX_Semaphore_Control *the_semaphore; Objects_Locations location; + Thread_Control *executing; the_semaphore = _POSIX_Semaphore_Get( sem, &location ); switch ( location ) { case OBJECTS_LOCAL: + executing = _Thread_Executing; _CORE_semaphore_Seize( &the_semaphore->Semaphore, + executing, the_semaphore->Object.id, blocking, timeout ); _Objects_Put( &the_semaphore->Object ); - if ( !_Thread_Executing->Wait.return_code ) + if ( !executing->Wait.return_code ) return 0; rtems_set_errno_and_return_minus_one( _POSIX_Semaphore_Translate_core_semaphore_return_code( - _Thread_Executing->Wait.return_code + executing->Wait.return_code ) ); |