diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-17 15:53:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-18 09:58:58 +0200 |
commit | 95e09afa92c5d0522a0d04019ef6680796688896 (patch) | |
tree | 2c04a60ed5669b4baba5a783e1919b4b4a37d858 /cpukit/score/src/coremutex.c | |
parent | score: Convert to inline function (diff) | |
download | rtems-95e09afa92c5d0522a0d04019ef6680796688896.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/score/src/coremutex.c')
-rw-r--r-- | cpukit/score/src/coremutex.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c index a39b4efebf..8ea7d13a4d 100644 --- a/cpukit/score/src/coremutex.c +++ b/cpukit/score/src/coremutex.c @@ -27,7 +27,8 @@ CORE_mutex_Status _CORE_mutex_Initialize( CORE_mutex_Control *the_mutex, - CORE_mutex_Attributes *the_mutex_attributes, + Thread_Control *executing, + const CORE_mutex_Attributes *the_mutex_attributes, uint32_t initial_lock ) { @@ -43,21 +44,21 @@ CORE_mutex_Status _CORE_mutex_Initialize( if ( initial_lock == CORE_MUTEX_LOCKED ) { the_mutex->nest_count = 1; - the_mutex->holder = _Thread_Executing; - the_mutex->holder_id = _Thread_Executing->Object.id; + the_mutex->holder = executing; + the_mutex->holder_id = executing->Object.id; if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { - if ( _Thread_Executing->current_priority < + if ( executing->current_priority < the_mutex->Attributes.priority_ceiling ) return CORE_MUTEX_STATUS_CEILING_VIOLATED; #ifdef __RTEMS_STRICT_ORDER_MUTEX__ - _Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex, + _Chain_Prepend_unprotected( &executing->lock_mutex, &the_mutex->queue.lock_queue ); - the_mutex->queue.priority_before = _Thread_Executing->current_priority; + the_mutex->queue.priority_before = executing->current_priority; #endif - _Thread_Executing->resource_count++; + executing->resource_count++; } } else { the_mutex->nest_count = 0; |