aboutsummaryrefslogtreecommitdiffhomepage
path: root/tdutils/td/utils
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2025-02-13 22:26:27 +0300
committerlevlam <levlam@telegram.org>2025-02-13 22:26:27 +0300
commitff103e3f9ff4ada94f36df00593ee2cb2f4369dd (patch)
tree2af3b6cbcd397d4b12daf03987cd35bbeab9c4ed /tdutils/td/utils
parentefe253f7d7c69fdc8cfff8b95ce4affdf9cebf17 (diff)
Replace init_slot with constructor.
Diffstat (limited to 'tdutils/td/utils')
-rw-r--r--tdutils/td/utils/MpmcWaiter.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/tdutils/td/utils/MpmcWaiter.h b/tdutils/td/utils/MpmcWaiter.h
index 8c4bb629d..bfd26c4b2 100644
--- a/tdutils/td/utils/MpmcWaiter.h
+++ b/tdutils/td/utils/MpmcWaiter.h
@@ -20,15 +20,14 @@ namespace td {
class MpmcEagerWaiter {
public:
struct Slot {
+ explicit Slot(uint32 worker_id) : yields(0), worker_id(worker_id) {
+ }
+
private:
friend class MpmcEagerWaiter;
int yields;
uint32 worker_id;
};
- static void init_slot(Slot &slot, uint32 worker_id) {
- slot.yields = 0;
- slot.worker_id = worker_id;
- }
void wait(Slot &slot) {
if (slot.yields < RoundsTillSleepy) {
@@ -163,6 +162,10 @@ class MpmcSleepyWaiter {
public:
char padding[TD_CONCURRENCY_PAD];
+
+ explicit Slot(int32 worker_id) : state_(State::Work), worker_id(worker_id) {
+ VLOG(waiter) << "Init slot " << worker_id;
+ }
};
// There are a lot of workers
@@ -194,13 +197,6 @@ class MpmcSleepyWaiter {
// If possible - in Search state
//
- static void init_slot(Slot &slot, int32 worker_id) {
- slot.state_ = Slot::State::Work;
- slot.unpark_flag_ = false;
- slot.worker_id = worker_id;
- VLOG(waiter) << "Init slot " << worker_id;
- }
-
static constexpr int VERBOSITY_NAME(waiter) = VERBOSITY_NAME(DEBUG) + 10;
void wait(Slot &slot) {
if (slot.state_ == Slot::State::Work) {