From e36f2b8c914b73bacfc89b997f4a59d5387303ce Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 18 Jul 2013 14:27:30 +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/semaphorewaitsupp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpukit/posix/src/semaphorewaitsupp.c') 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 ) ); -- cgit v1.2.3