sched_nr_worker: make cond var to sync workers an integer

the boolean isn't enough for more than 2 PHY workers, replace by int
master
Andre Puschmann 3 years ago committed by Xavier Arteaga
parent 3b5344b0f7
commit 2adb1c0723

@ -120,7 +120,7 @@ private:
std::vector<std::unique_ptr<slot_worker_ctxt> > slot_worker_ctxts;
struct cc_context {
std::condition_variable cvar;
bool waiting = false;
int waiting = 0;
slot_cc_worker worker;
cc_context(serv_cell_manager& sched) : worker(sched) {}

@ -237,9 +237,9 @@ void sched_worker_manager::run_slot(slot_point slot_tx, uint32_t cc, dl_sched_t&
std::unique_lock<std::mutex> lock(slot_mutex);
while (current_slot.valid() and current_slot != slot_tx) {
// Wait for previous slot to finish
cc_worker_list[cc]->waiting = true;
cc_worker_list[cc]->waiting++;
cc_worker_list[cc]->cvar.wait(lock);
cc_worker_list[cc]->waiting = false;
cc_worker_list[cc]->waiting--;
}
if (not current_slot.valid()) {
/* First Worker to start slot */
@ -261,7 +261,7 @@ void sched_worker_manager::run_slot(slot_point slot_tx, uint32_t cc, dl_sched_t&
current_slot = slot_tx;
worker_count.store(static_cast<int>(cc_worker_list.size()), std::memory_order_relaxed);
for (auto& w : cc_worker_list) {
if (w->waiting) {
if (w->waiting > 0) {
waiting_cvars.push_back(&w->cvar);
}
}
@ -301,7 +301,7 @@ void sched_worker_manager::run_slot(slot_point slot_tx, uint32_t cc, dl_sched_t&
// All the workers of the same slot have finished. Synchronize scheduling decisions with UEs state
for (auto& c : cc_worker_list) {
c->worker.finish();
if (c->waiting) {
if (c->waiting > 0) {
waiting_cvars.push_back(&c->cvar);
}
}

Loading…
Cancel
Save