From 9949d8a7d042da7ba53516300db5c34c8b9c8a31 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 12 May 2016 16:32:27 +0200 Subject: score: Add Thread_Change_life() Add _Thread_Change_life_locked() as a general function to alter the thread life state. Use it to implement _Thread_Set_life_protection() as a first step. Update #2555. Update #2626. --- testsuites/sptests/spthreadlife01/init.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/spthreadlife01/init.c b/testsuites/sptests/spthreadlife01/init.c index 6bf2d7f372..7724635cd9 100644 --- a/testsuites/sptests/spthreadlife01/init.c +++ b/testsuites/sptests/spthreadlife01/init.c @@ -231,7 +231,7 @@ static void worker_task(rtems_task_argument arg) while (true) { test_state state = ctx->current; rtems_status_code sc; - bool previous_thread_life_protection; + Thread_Life_state previous_thread_life_state; switch (state) { case SET_PRIO: @@ -273,14 +273,19 @@ static void worker_task(rtems_task_argument arg) break; case SET_PROTECTION: _Thread_Disable_dispatch(); - previous_thread_life_protection = _Thread_Set_life_protection(true); - rtems_test_assert(!previous_thread_life_protection); + previous_thread_life_state = + _Thread_Set_life_protection(THREAD_LIFE_PROTECTED); + rtems_test_assert( + (previous_thread_life_state & THREAD_LIFE_PROTECTED) == 0 + ); _Thread_Enable_dispatch(); break; case CLEAR_PROTECTION: _Thread_Disable_dispatch(); - previous_thread_life_protection = _Thread_Set_life_protection(false); - rtems_test_assert(previous_thread_life_protection); + previous_thread_life_state = _Thread_Set_life_protection(0); + rtems_test_assert( + (previous_thread_life_state & THREAD_LIFE_PROTECTED) != 0 + ); ctx->current = DELETE_4; _Thread_Enable_dispatch(); break; -- cgit v1.2.3