Skip to content

Commit 0f0d479

Browse files
committed
fix Worker name
1 parent a8bd059 commit 0f0d479

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

include/reactor-cpp/scheduler.hh

+3-5
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public:
7474
auto create_worker() -> Worker<DefaultSchedulingPolicy> { return {*this, identity_counter++}; }
7575
};
7676

77+
using DefaultWorker = Worker<DefaultSchedulingPolicy>;
78+
7779
class ReadyQueue {
7880
private:
79-
using Worker = Worker<DefaultSchedulingPolicy>;
80-
8181
std::vector<Reaction*> queue_{};
8282
std::atomic<std::ptrdiff_t> size_{0};
8383
Semaphore sem_{0};
@@ -113,15 +113,13 @@ using EventMap = std::map<BaseAction*, std::function<void(void)>>;
113113

114114
class Scheduler { // NOLINT
115115
private:
116-
using Worker = Worker<DefaultSchedulingPolicy>;
117-
118116
DefaultSchedulingPolicy policy_;
119117

120118
const bool using_workers_;
121119
LogicalTime logical_time_{};
122120

123121
Environment* environment_;
124-
std::vector<Worker> workers_{};
122+
std::vector<DefaultWorker> workers_{};
125123

126124
std::mutex scheduling_mutex_;
127125
std::unique_lock<std::mutex> scheduling_lock_{scheduling_mutex_, std::defer_lock};

lib/scheduler.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ auto ReadyQueue::pop() -> Reaction* {
7171

7272
// If there is no ready reaction available, wait until there is one.
7373
while (old_size <= 0) {
74-
log::Debug() << "(Worker " << Worker::current_worker_id() << ") Wait for work";
74+
log::Debug() << "(Worker " << DefaultWorker::current_worker_id() << ") Wait for work";
7575
sem_.acquire();
76-
log::Debug() << "(Worker " << Worker::current_worker_id() << ") Waking up";
76+
log::Debug() << "(Worker " << DefaultWorker::current_worker_id() << ") Waking up";
7777
old_size = size_.fetch_sub(1, std::memory_order_acq_rel);
7878
// FIXME: Protect against underflow?
7979
}
@@ -344,15 +344,15 @@ void Scheduler::set_port(BasePort* port) {
344344
// We do not check here if port is already in the list. This means clean()
345345
// could be called multiple times for a single port. However, calling
346346
// clean() multiple time is not harmful and more efficient then checking if
347-
set_ports_[Worker::current_worker_id()].push_back(port);
347+
set_ports_[DefaultWorker::current_worker_id()].push_back(port);
348348

349349
// recursively search for triggered reactions
350350
set_port_helper(port);
351351
}
352352

353353
void Scheduler::set_port_helper(BasePort* port) {
354354
for (auto* reaction : port->triggers()) {
355-
triggered_reactions_[Worker::current_worker_id()].push_back(reaction);
355+
triggered_reactions_[DefaultWorker::current_worker_id()].push_back(reaction);
356356
}
357357
for (auto* binding : port->outward_bindings()) {
358358
set_port_helper(binding);

0 commit comments

Comments
 (0)