性能优化2,有待测试版本,修复编译bug
This commit is contained in:
parent
b62391fa97
commit
de3b8a47eb
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user