diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_worker.h b/srsenb/hdr/stack/mac/nr/sched_nr_worker.h index 0818cca28..c9b14a35e 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_worker.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_worker.h @@ -120,7 +120,7 @@ private: std::vector > 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) {} diff --git a/srsenb/src/stack/mac/nr/sched_nr_worker.cc b/srsenb/src/stack/mac/nr/sched_nr_worker.cc index dbb99ff91..0b783d2b6 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_worker.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_worker.cc @@ -237,9 +237,9 @@ void sched_worker_manager::run_slot(slot_point slot_tx, uint32_t cc, dl_sched_t& std::unique_lock 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(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); } }