diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-23 10:01:22 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 12:00:45 +0200 |
commit | 02c4c441a51b43b55608893efa4a80a62bb9d4d5 (patch) | |
tree | 709655b1c53afc3ff981890989a5290d1c400ad2 /cpukit/score/src/coremutexseize.c | |
parent | score: Generalize _Event_Timeout() (diff) | |
download | rtems-02c4c441a51b43b55608893efa4a80a62bb9d4d5.tar.bz2 |
score: Add Thread_queue_Control::Lock
Move the complete thread queue enqueue procedure into
_Thread_queue_Enqueue_critical(). It is possible to use the thread
queue lock to protect state of the object embedding the thread queue.
This enables per object fine grained locking in the future.
Delete _Thread_queue_Enter_critical_section().
Update #2273.
Diffstat (limited to 'cpukit/score/src/coremutexseize.c')
-rw-r--r-- | cpukit/score/src/coremutexseize.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c index 3fc3765ef4..67954b697b 100644 --- a/cpukit/score/src/coremutexseize.c +++ b/cpukit/score/src/coremutexseize.c @@ -53,27 +53,35 @@ void _CORE_mutex_Seize_interrupt_blocking( ISR_lock_Context *lock_context ) { - _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue ); - executing->Wait.queue = &the_mutex->Wait_queue; _Thread_Disable_dispatch(); - _ISR_lock_ISR_enable( lock_context ); if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) { Thread_Control *holder = the_mutex->holder; + /* + * To enable interrupts here works only since we own the Giant lock and + * only threads are allowed to seize and surrender mutexes with the + * priority inheritance protocol. + */ + _ISR_lock_ISR_enable( lock_context ); + _Scheduler_Change_priority_if_higher( _Scheduler_Get( holder ), holder, executing->current_priority, false ); + + _ISR_lock_ISR_disable( lock_context ); } - _Thread_queue_Enqueue( + _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context ); + _Thread_queue_Enqueue_critical( &the_mutex->Wait_queue, executing, STATES_WAITING_FOR_MUTEX, - timeout + timeout, + lock_context ); _Thread_Enable_dispatch(); |