MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / PopFront

Method PopFront

include/Eigen/src/ThreadPool/RunQueue.h:68–78  ·  view source on GitHub ↗

PopFront removes and returns the first element in the queue. If the queue was empty returns default-constructed Work.

Source from the content-addressed store, hash-verified

66 // PopFront removes and returns the first element in the queue.
67 // If the queue was empty returns default-constructed Work.
68 Work PopFront() {
69 unsigned front = front_.load(std::memory_order_relaxed);
70 Elem* e = &array_[(front - 1) & kMask];
71 uint8_t s = e->state.load(std::memory_order_relaxed);
72 if (s != kReady || !e->state.compare_exchange_strong(s, kBusy, std::memory_order_acquire)) return Work();
73 Work w = std::move(e->w);
74 e->state.store(kEmpty, std::memory_order_release);
75 front = ((front - 1) & kMask2) | (front & ~kMask2);
76 front_.store(front, std::memory_order_relaxed);
77 return w;
78 }
79
80 // PushBack adds w at the end of the queue.
81 // If queue is full returns w, otherwise returns default-constructed Work.

Callers 1

WorkerLoopMethod · 0.45

Calls 2

loadMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected