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/score/include/rtems/score/coresemimpl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cpukit/score/include') diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h index 62c1c2abf8..35fbce59d0 100644 --- a/cpukit/score/include/rtems/score/coresemimpl.h +++ b/cpukit/score/include/rtems/score/coresemimpl.h @@ -108,6 +108,7 @@ void _CORE_semaphore_Initialize( * available. * * @param[in] the_semaphore is the semaphore to seize + * @param[in,out] executing The currently executing thread. * @param[in] id is the Id of the API level Semaphore object associated * with this instance of a SuperCore Semaphore * @param[in] wait indicates if the caller is willing to block @@ -116,6 +117,7 @@ void _CORE_semaphore_Initialize( */ void _CORE_semaphore_Seize( CORE_semaphore_Control *the_semaphore, + Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout @@ -201,6 +203,7 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( * available. * * @param[in] the_semaphore is the semaphore to obtain + * @param[in,out] executing The currently executing thread. * @param[in] id is the Id of the owning API level Semaphore object * @param[in] wait is true if the thread is willing to wait * @param[in] timeout is the maximum number of ticks to block @@ -211,17 +214,15 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( */ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable( CORE_semaphore_Control *the_semaphore, + Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout, ISR_Level level ) { - Thread_Control *executing; - /* disabled when you get here */ - executing = _Thread_Executing; executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; if ( the_semaphore->count != 0 ) { the_semaphore->count -= 1; -- cgit v1.2.3