diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-11 11:54:49 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-12 13:24:41 +0200 |
commit | bd12dda405e1bab16c522f7ef0dd2b455230d269 (patch) | |
tree | c644df77b8512e1e211bfae39587511d0774f0d8 /testsuites/tmtests/tm27 | |
parent | rtems: Avoid Giant lock rtems_task_is_suspended() (diff) | |
download | rtems-bd12dda405e1bab16c522f7ef0dd2b455230d269.tar.bz2 |
score: Use thread state lock for current state
In addition protect scheduler of thread by thread state lock. Enables
use of scheduler per-instance locks.
Update #2555.
Diffstat (limited to 'testsuites/tmtests/tm27')
-rw-r--r-- | testsuites/tmtests/tm27/task1.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c index d351b4145a..77072bb91c 100644 --- a/testsuites/tmtests/tm27/task1.c +++ b/testsuites/tmtests/tm27/task1.c @@ -225,9 +225,15 @@ rtems_task Task_2( ) { Thread_Control *executing = _Thread_Get_executing(); - Scheduler_priority_Context *scheduler_context = - _Scheduler_priority_Get_context( _Scheduler_Get( executing ) ); - ISR_lock_Context lock_context; + const Scheduler_Control *scheduler; + Scheduler_priority_Context *scheduler_context; + ISR_lock_Context state_lock_context; + ISR_lock_Context scheduler_lock_context; + + _Thread_State_acquire( executing, &state_lock_context ); + scheduler = _Scheduler_Get( executing ); + scheduler_context = _Scheduler_priority_Get_context( scheduler ); + _Thread_State_release( executing, &state_lock_context ); #if (MUST_WAIT_FOR_INTERRUPT == 1) while ( Interrupt_occurred == 0 ); @@ -256,14 +262,16 @@ rtems_task Task_2( * Switch back to the other task to exit the test. */ - _Scheduler_Acquire( executing, &lock_context ); + _Thread_State_acquire( executing, &state_lock_context ); + _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); _Thread_Executing = (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]); _Thread_Dispatch_necessary = 1; - _Scheduler_Release( executing, &lock_context ); + _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); + _Thread_State_release( executing, &state_lock_context ); _Thread_Dispatch(); |