samples: mec15xxevb_assy6853/pm: abort threads before reuse

Threads are being re-used for multiple runs, so it is better to
stop the threads before reusing the variables for new threads.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-04-08 12:14:24 -07:00 committed by Anas Nashif
commit fd1d93e552

View file

@ -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) static void suspend_all_tasks(void)
{ {
k_thread_suspend(&threadA_id); k_thread_suspend(&threadA_id);
@ -191,6 +200,8 @@ int test_pwr_mgmt_multithread(bool use_logging, u8_t cycles)
resume_all_tasks(); resume_all_tasks();
} }
destroy_tasks();
pm_reset_counters(); pm_reset_counters();
return 0; return 0;