diff options
| author | gingerBill <bill@gingerbill.org> | 2021-07-27 20:45:50 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-07-27 20:45:50 +0100 |
| commit | 9cd5ea59dd091083555d7aea691fcd889e67fb67 (patch) | |
| tree | 335bd28d0bcaf8b1705d08be10451227f4ddf51d /src/queue.cpp | |
| parent | 116e98b37891091841976d1c70ec1fb39c439d8a (diff) | |
Big simplification and improvement of the entity collection system, reducing unneeded steps for packages
Diffstat (limited to 'src/queue.cpp')
| -rw-r--r-- | src/queue.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/queue.cpp b/src/queue.cpp index da3cef687..4d7c0f052 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -64,6 +64,10 @@ void mpmc_destroy(MPMCQueue<T> *q) { template <typename T> isize mpmc_enqueue(MPMCQueue<T> *q, T const &data) { + if (q->mask == 0) { + return -1; + } + isize head_idx = q->head_idx.load(std::memory_order_relaxed); for (;;) { @@ -101,9 +105,12 @@ isize mpmc_enqueue(MPMCQueue<T> *q, T const &data) { } } - template <typename T> bool mpmc_dequeue(MPMCQueue<T> *q, T *data_) { + if (q->mask == 0) { + return false; + } + isize tail_idx = q->tail_idx.load(std::memory_order_relaxed); for (;;) { |