diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-21 10:30:34 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-21 11:48:25 +0200 |
commit | 82f907430887607180211c2eba06c03ae0f175e0 (patch) | |
tree | df62cdce1b38195c6ab55536567ca1ded11ced7f /testsuites/smptests/smpthreadlife01 | |
parent | score: Add and use _Scheduler_Get_index_by_id() (diff) | |
download | rtems-82f907430887607180211c2eba06c03ae0f175e0.tar.bz2 |
score: _Thread_Set_life_protection()
Enable usage of _Thread_Set_life_protection() in thread dispatch
critical sections. This can be used to enable the thread
life-protection with thread dispatching disabled and then enable thread
dispatching.
Diffstat (limited to 'testsuites/smptests/smpthreadlife01')
-rw-r--r-- | testsuites/smptests/smpthreadlife01/init.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/testsuites/smptests/smpthreadlife01/init.c b/testsuites/smptests/smpthreadlife01/init.c index 38b054f41c..0a8b068eee 100644 --- a/testsuites/smptests/smpthreadlife01/init.c +++ b/testsuites/smptests/smpthreadlife01/init.c @@ -182,7 +182,7 @@ static void test_delete(void) } } -static void delay_ipi_task(rtems_task_argument arg) +static void delay_ipi_task(rtems_task_argument variant) { test_context *ctx = &test_instance; rtems_interrupt_level level; @@ -198,12 +198,24 @@ static void delay_ipi_task(rtems_task_argument arg) */ rtems_counter_delay_nanoseconds(100000000); - /* We get deleted as a side effect of enabling the thread life protection */ + if (variant != 0) { + _Thread_Disable_dispatch(); + } + + /* + * We get deleted as a side effect of enabling the thread life protection or + * later if we enable the thread dispatching. + */ _Thread_Set_life_protection(true); + + if (variant != 0) { + _Thread_Enable_dispatch(); + } + rtems_test_assert(0); } -static void test_set_life_protection(void) +static void test_set_life_protection(rtems_task_argument variant) { test_context *ctx = &test_instance; rtems_status_code sc; @@ -222,7 +234,7 @@ static void test_set_life_protection(void) ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); - sc = rtems_task_start(id, delay_ipi_task, 0); + sc = rtems_task_start(id, delay_ipi_task, variant); rtems_test_assert(sc == RTEMS_SUCCESSFUL); _SMP_barrier_Wait(&ctx->barrier, &ctx->main_barrier_state, CPU_COUNT); @@ -301,7 +313,8 @@ static void Init(rtems_task_argument arg) if (rtems_get_processor_count() >= CPU_COUNT) { test_restart(); test_delete(); - test_set_life_protection(); + test_set_life_protection(0); + test_set_life_protection(1); test_wait_for_execution_stop(); } |