MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / push

Method push

3rdparty/asyncplusplus/src/work_steal_queue.h:104–121  ·  view source on GitHub ↗

Push a task to the bottom of this thread's queue

Source from the content-addressed store, hash-verified

102
103 // Push a task to the bottom of this thread's queue
104 void push(task_run_handle x)
105 {
106 std::size_t b = bottom.load(std::memory_order_relaxed);
107 std::size_t t = top.load(std::memory_order_acquire);
108 circular_array* a = array.load(std::memory_order_relaxed);
109
110 // Grow the array if it is full
111 if (to_signed(b - t) >= to_signed(a->size())) {
112 a = a->grow(t, b);
113 array.store(a, std::memory_order_release);
114 }
115
116 // Note that we only convert to void* here in case grow throws due to
117 // lack of memory.
118 a->put(b, x.to_void_ptr());
119 std::atomic_thread_fence(std::memory_order_release);
120 bottom.store(b + 1, std::memory_order_relaxed);
121 }
122
123 // Pop a task from the bottom of this thread's queue
124 task_run_handle pop()

Callers

nothing calls this directly

Calls 5

growMethod · 0.80
putMethod · 0.80
to_void_ptrMethod · 0.80
loadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected