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

Method PopBack

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

PopBack removes and returns the last elements in the queue.

Source from the content-addressed store, hash-verified

94
95 // PopBack removes and returns the last elements in the queue.
96 Work PopBack() {
97 if (Empty()) return Work();
98 EIGEN_MUTEX_LOCK lock(mutex_);
99 unsigned back = back_.load(std::memory_order_relaxed);
100 Elem* e = &array_[back & kMask];
101 uint8_t s = e->state.load(std::memory_order_relaxed);
102 if (s != kReady || !e->state.compare_exchange_strong(s, kBusy, std::memory_order_acquire)) return Work();
103 Work w = std::move(e->w);
104 e->state.store(kEmpty, std::memory_order_release);
105 back_.store(back + 1 + (kSize << 1), std::memory_order_relaxed);
106 return w;
107 }
108
109 // PopBackHalf removes and returns half last elements in the queue.
110 // Returns number of elements removed.

Callers 2

StealMethod · 0.45
WaitForWorkMethod · 0.45

Calls 3

EmptyFunction · 0.85
loadMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected