diff --git a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c index 6face4d54d2..4d11198ce59 100644 --- a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c +++ b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c @@ -134,6 +134,15 @@ static void create_tasks(void) } +static void destroy_tasks(void) +{ + k_thread_abort(&threadA_id); + k_thread_abort(&threadB_id); + + k_thread_join(&threadA_id, K_FOREVER); + k_thread_join(&threadB_id, K_FOREVER); +} + static void suspend_all_tasks(void) { k_thread_suspend(&threadA_id); @@ -191,6 +200,8 @@ int test_pwr_mgmt_multithread(bool use_logging, u8_t cycles) resume_all_tasks(); } + destroy_tasks(); + pm_reset_counters(); return 0;