MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / PushFront

Method PushFront

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

PushFront inserts w at the beginning of the queue. If queue is full returns w, otherwise returns default-constructed Work.

Source from the content-addressed store, hash-verified

53 // PushFront inserts w at the beginning of the queue.
54 // If queue is full returns w, otherwise returns default-constructed Work.
55 Work PushFront(Work w) {
56 unsigned front = front_.load(std::memory_order_relaxed);
57 Elem* e = &array_[front & kMask];
58 uint8_t s = e->state.load(std::memory_order_relaxed);
59 if (s != kEmpty ||
60 !e->state.compare_exchange_strong(s, kBusy, std::memory_order_acquire))
61 return w;
62 front_.store(front + 1 + (kSize << 1), std::memory_order_relaxed);
63 e->w = std::move(w);
64 e->state.store(kReady, std::memory_order_release);
65 return Work();
66 }
67
68 // PopFront removes and returns the first element in the queue.
69 // If the queue was empty returns default-constructed Work.

Callers 1

ScheduleWithHintMethod · 0.80

Calls 2

loadMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected