Skip to content

Commit

Permalink
Minor waiter code refactoring (#1262)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitri Mokhov <[email protected]>
  • Loading branch information
dnmokhov authored Nov 16, 2023
1 parent de0a3a6 commit f71c92a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/tbb/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ void arena::advertise_new_work() {
workers_delta = 1;
}

bool wakeup_workers = is_mandatory_needed || are_workers_needed;
request_workers(mandatory_delta, workers_delta, wakeup_workers);
request_workers(mandatory_delta, workers_delta, /* wakeup_threads = */ true);
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/tbb/waiters.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class sleep_waiter : public waiter_base {
void sleep(std::uintptr_t uniq_tag, Pred wakeup_condition) {
my_arena.get_waiting_threads_monitor().wait<thread_control_monitor::thread_context>(wakeup_condition,
market_context{uniq_tag, &my_arena});
reset_wait();
}
};

Expand All @@ -139,7 +140,6 @@ class external_waiter : public sleep_waiter {
auto wakeup_condition = [&] { return !my_arena.is_empty() || !my_wait_ctx.continue_execution(); };

sleep(std::uintptr_t(&my_wait_ctx), wakeup_condition);
my_backoff.reset_wait();
}

d1::wait_context* wait_ctx() {
Expand Down Expand Up @@ -176,11 +176,6 @@ class coroutine_waiter : public sleep_waiter {
auto wakeup_condition = [&] { return !my_arena.is_empty() || sp->m_is_owner_recalled.load(std::memory_order_relaxed); };

sleep(std::uintptr_t(sp), wakeup_condition);
my_backoff.reset_wait();
}

void reset_wait() {
my_backoff.reset_wait();
}

d1::wait_context* wait_ctx() {
Expand Down

0 comments on commit f71c92a

Please sign in to comment.