diff options
Diffstat (limited to 'testsuites/smptests/smpscheduler03')
-rw-r--r-- | testsuites/smptests/smpscheduler03/init.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c index 4a3aa54ca5..1888048d28 100644 --- a/testsuites/smptests/smpscheduler03/init.c +++ b/testsuites/smptests/smpscheduler03/init.c @@ -193,11 +193,15 @@ static Thread_Control *change_priority_op( bool prepend_it ) { - const Scheduler_Control *scheduler = _Scheduler_Get(thread); + const Scheduler_Control *scheduler; + ISR_lock_Context state_lock_context; + ISR_lock_Context scheduler_lock_context; Thread_Control *needs_help; - ISR_lock_Context lock_context; - _Scheduler_Acquire(thread, &lock_context); + _Thread_State_acquire( thread, &state_lock_context ); + scheduler = _Scheduler_Get( thread ); + _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); + thread->current_priority = new_priority; needs_help = (*scheduler->Operations.change_priority)( scheduler, @@ -205,7 +209,9 @@ static Thread_Control *change_priority_op( new_priority, prepend_it ); - _Scheduler_Release(thread, &lock_context); + + _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); + _Thread_State_release( thread, &state_lock_context ); return needs_help; } @@ -302,13 +308,19 @@ static void test_change_priority_op(void) static Thread_Control *yield_op(Thread_Control *thread) { - const Scheduler_Control *scheduler = _Scheduler_Get(thread); + const Scheduler_Control *scheduler; + ISR_lock_Context state_lock_context; + ISR_lock_Context scheduler_lock_context; Thread_Control *needs_help; - ISR_lock_Context lock_context; - _Scheduler_Acquire(thread, &lock_context); + _Thread_State_acquire( thread, &state_lock_context ); + scheduler = _Scheduler_Get( thread ); + _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); + needs_help = (*scheduler->Operations.yield)(scheduler, thread); - _Scheduler_Release(thread, &lock_context); + + _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); + _Thread_State_release( thread, &state_lock_context ); return needs_help; } @@ -429,23 +441,35 @@ static void test_yield_op(void) static void block_op(Thread_Control *thread) { - const Scheduler_Control *scheduler = _Scheduler_Get(thread); - ISR_lock_Context lock_context; + const Scheduler_Control *scheduler; + ISR_lock_Context state_lock_context; + ISR_lock_Context scheduler_lock_context; + + _Thread_State_acquire( thread, &state_lock_context ); + scheduler = _Scheduler_Get( thread ); + _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); - _Scheduler_Acquire(thread, &lock_context); (*scheduler->Operations.block)(scheduler, thread); - _Scheduler_Release(thread, &lock_context); + + _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); + _Thread_State_release( thread, &state_lock_context ); } static Thread_Control *unblock_op(Thread_Control *thread) { - const Scheduler_Control *scheduler = _Scheduler_Get(thread); + const Scheduler_Control *scheduler; + ISR_lock_Context state_lock_context; + ISR_lock_Context scheduler_lock_context; Thread_Control *needs_help; - ISR_lock_Context lock_context; - _Scheduler_Acquire(thread, &lock_context); + _Thread_State_acquire( thread, &state_lock_context ); + scheduler = _Scheduler_Get( thread ); + _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); + needs_help = (*scheduler->Operations.unblock)(scheduler, thread); - _Scheduler_Release(thread, &lock_context); + + _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); + _Thread_State_release( thread, &state_lock_context ); return needs_help; } |