32 Node* front =
_head.load(std::memory_order_relaxed);
33 front->Next.store(
nullptr, std::memory_order_relaxed);
42 Node* front =
_head.load(std::memory_order_relaxed);
48 Node* node =
new Node(input);
49 Node* prevHead =
_head.exchange(node, std::memory_order_acq_rel);
50 prevHead->Next.store(node, std::memory_order_release);
55 Node* tail =
_tail.load(std::memory_order_relaxed);
56 Node*
next = tail->Next.load(std::memory_order_acquire);
61 _tail.store(next, std::memory_order_release);
70 explicit Node(T* data) :
Data(data) {
Next.store(
nullptr, std::memory_order_relaxed); }
83 #endif // MPSCQueue_h__
MPSCQueue & operator=(MPSCQueue const &)=delete
bool Dequeue(T *&result)
Definition: MPSCQueue.h:53
MPSCQueue()
Definition: MPSCQueue.h:30
Definition: MPSCQueue.h:27
T * Data
Definition: MPSCQueue.h:72
int next(int i, int n)
Definition: RecastContour.cpp:469
std::atomic< Node * > _tail
Definition: MPSCQueue.h:77
Definition: MPSCQueue.h:67
void Enqueue(T *input)
Definition: MPSCQueue.h:46
~MPSCQueue()
Definition: MPSCQueue.h:36
std::atomic< Node * > _head
Definition: MPSCQueue.h:76
Node(T *data)
Definition: MPSCQueue.h:70
std::atomic< Node * > Next
Definition: MPSCQueue.h:73
Data
Definition: molten_core.h:69