Skip to content

Commit 71e7eb8

Browse files
Fixes for task_bench (#7359)
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
1 parent 901701c commit 71e7eb8

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

src/tasks/test/bench/contention_bench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void dequeue_many(picobench::state& s, size_t thread_count, size_t task_count)
7979
for (auto i = 0; i < thread_count; ++i)
8080
{
8181
threads.emplace_back([task_count, &tasks_done]() {
82-
if (tasks_done.load() < task_count)
82+
while (tasks_done.load() < task_count)
8383
{
8484
auto task = ccf::tasks::get_main_job_board().get_task();
8585
if (task != nullptr)

src/tasks/test/bench/flush_all_tasks.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
#include "tasks/task_system.h"
66

77
static inline void flush_all_tasks(
8-
std::atomic<bool>& stop_signal,
9-
size_t worker_count,
10-
std::chrono::seconds kill_after = std::chrono::seconds(5))
8+
std::atomic<bool>& stop_signal, size_t worker_count)
119
{
1210
std::vector<std::thread> workers;
1311
for (size_t i = 0; i < worker_count; ++i)
@@ -28,17 +26,10 @@ static inline void flush_all_tasks(
2826
using TClock = std::chrono::steady_clock;
2927
auto now = TClock::now();
3028

31-
const auto hard_end = now + kill_after;
32-
3329
while (true)
3430
{
3531
std::this_thread::sleep_for(std::chrono::milliseconds(1));
3632
now = TClock::now();
37-
if (now > hard_end)
38-
{
39-
break;
40-
}
41-
4233
if (stop_signal.load())
4334
{
4435
break;

0 commit comments

Comments
 (0)