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:
parent
17a932c107
commit
fd1d93e552
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue