threadsafe_queue: Address lioncash's review

This commit is contained in:
yzct12345
2021-08-15 08:37:59 +00:00
committed by GitHub
parent 22bb4b86d1
commit 436c674c96

View File

@@ -19,7 +19,7 @@ public:
~MPMCQueue() {
Clear();
if (waiting || head || tail) {
// All the abort() after 1 month merged without problems
// Remove all the abort() after 1 month merged without problems
abort();
}
}
@@ -116,7 +116,7 @@ private:
while (true) {
Node* const node = head.load(ACQUIRE);
if (!node) {
if (!WAIT) {
if constexpr (!WAIT) {
return false;
}
if (!lock) {
@@ -164,8 +164,11 @@ private:
template <typename Arg>
explicit Node(Arg&& t) : value{std::forward<Arg>(t)} {}
Node(Node&) = delete;
Node(const Node&) = delete;
Node& operator=(const Node&) = delete;
Node(Node&&) = delete;
Node& operator=(Node&&) = delete;
const T value;
std::atomic<Node*> next{nullptr};