fix task scheduler test

This commit is contained in:
Francisco 2021-05-17 19:02:35 +01:00 committed by Ismael Gomez
parent 2d6a878826
commit b41aba2a03
1 changed files with 8 additions and 3 deletions

View File

@ -43,7 +43,10 @@ int test_task_scheduler_no_pool()
task_sched.notify_background_task_result([&state]() { state = task_result::external; });
});
TESTASSERT(state == task_result::null);
task_sched.run_next_task(); // runs notification
while (state != task_result::external) {
task_sched.run_pending_tasks(); // runs notification
std::this_thread::sleep_for(std::chrono::microseconds(100));
}
TESTASSERT(state == task_result::external);
return SRSRAN_SUCCESS;
@ -58,8 +61,10 @@ int test_task_scheduler_with_pool()
task_sched.notify_background_task_result([&state]() { state = task_result::external; });
});
TESTASSERT(state == task_result::null);
task_sched.run_next_task(); // waits and runs notification
TESTASSERT(state == task_result::external);
while (state != task_result::external) {
task_sched.run_pending_tasks(); // runs notification
std::this_thread::sleep_for(std::chrono::microseconds(100));
}
return SRSRAN_SUCCESS;
}