srsue,mac: fix race between PHY and MAC when stopping UE

the issue let to unwanted log warning at the end of the UE
execution when the PHY was still pushing DL PDUs while MAC
was already stopped.

This fixes #3003
master
Andre Puschmann 3 years ago
parent e70b8c2472
commit e2c496d825

@ -158,7 +158,7 @@ private:
mac_metrics_t metrics[SRSRAN_MAX_CARRIERS] = {};
bool initialized = false;
std::atomic<bool> initialized = {false};
const uint8_t PCELL_CC_IDX = 0;
};

@ -473,11 +473,11 @@ void mac::process_pdus()
// dispatch work to stack thread
auto ret = stack_task_dispatch_queue.try_push([this]() {
bool have_data = true;
while (initialized and have_data) {
while (initialized.load(std::memory_order_relaxed) and have_data) {
have_data = demux_unit.process_pdus();
}
});
if (ret.is_error()) {
if (ret.is_error() && initialized.load(std::memory_order_relaxed)) {
Warning("Failed to dispatch mac::%s task to stack thread", __func__);
}
}

Loading…
Cancel
Save