性能优化2,有待测试版本,修复编译bug
Some checks are pending
CI / host-build (push) Waiting to run
CI / rk3588-cross-build (push) Waiting to run

This commit is contained in:
sladro 2026-01-12 17:58:23 +08:00
parent b62391fa97
commit de3b8a47eb

View File

@ -184,6 +184,19 @@ private:
struct Cell {
std::atomic<size_t> seq;
T data;
Cell() : seq(0), data() {}
Cell(const Cell&) = delete;
Cell& operator=(const Cell&) = delete;
Cell(Cell&& other) noexcept
: seq(other.seq.load(std::memory_order_relaxed)), data(std::move(other.data)) {}
Cell& operator=(Cell&& other) noexcept {
if (this != &other) {
seq.store(other.seq.load(std::memory_order_relaxed), std::memory_order_relaxed);
data = std::move(other.data);
}
return *this;
}
};
// Lock-free bounded MPMC queue (Vyukov). We still expose it as SPSC in this project,