Push a task to the bottom of this thread's queue
| 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() |
nothing calls this directly
no test coverage detected