// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2026 Martino Ferrari #include "source/data_source.hpp" #include namespace udpscope { void DataSource::post(Command cmd) { std::lock_guard lk(cmd_mu_); cmds_.push_back(std::move(cmd)); } void DataSource::drain_commands() { std::deque local; { std::lock_guard lk(cmd_mu_); local.swap(cmds_); } for (auto& c : local) c(); } } // namespace udpscope