[UNTESTED] small fixes for consistency
This commit is contained in:
@@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <bit>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace THWeaver {
|
namespace THWeaver {
|
||||||
|
|
||||||
@@ -141,7 +143,8 @@ public:
|
|||||||
"Thread ID out of bounds");
|
"Thread ID out of bounds");
|
||||||
|
|
||||||
in_queues[thread_id].flush();
|
in_queues[thread_id].flush();
|
||||||
hint.fetch_and(~(1 << thread_id), std::memory_order_relaxed);
|
hint.fetch_and(~(BitmapType(1) << thread_id),
|
||||||
|
std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_all() noexcept {
|
void flush_all() noexcept {
|
||||||
@@ -158,7 +161,7 @@ public:
|
|||||||
"Thread ID out of bounds");
|
"Thread ID out of bounds");
|
||||||
|
|
||||||
return static_cast<FanInFabricSendResult>(static_cast<uint32_t>(
|
return static_cast<FanInFabricSendResult>(static_cast<uint32_t>(
|
||||||
in_queues[thread_id].send(message)));
|
in_queues[thread_id].send(std::move(message))));
|
||||||
}
|
}
|
||||||
|
|
||||||
FanInFabricRecvBitmapResult
|
FanInFabricRecvBitmapResult
|
||||||
@@ -178,7 +181,7 @@ public:
|
|||||||
std::size_t qsize = ((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
std::size_t qsize = ((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
||||||
|
|
||||||
if (qsize <= 1)
|
if (qsize <= 1)
|
||||||
hint.fetch_and(~(1 << hinted_id),
|
hint.fetch_and(~(BitmapType(1) << hinted_id),
|
||||||
std::memory_order_relaxed);
|
std::memory_order_relaxed);
|
||||||
|
|
||||||
if (qsize) {
|
if (qsize) {
|
||||||
@@ -205,7 +208,7 @@ public:
|
|||||||
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
||||||
|
|
||||||
if (qsize <= 1)
|
if (qsize <= 1)
|
||||||
hint.fetch_and(~(1 << hinted_id),
|
hint.fetch_and(~(BitmapType(1) << hinted_id),
|
||||||
std::memory_order_relaxed);
|
std::memory_order_relaxed);
|
||||||
|
|
||||||
if (qsize) {
|
if (qsize) {
|
||||||
@@ -241,7 +244,7 @@ public:
|
|||||||
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
|
||||||
|
|
||||||
if (qsize <= 1)
|
if (qsize <= 1)
|
||||||
hint.fetch_and(~(1 << hinted_id),
|
hint.fetch_and(~(BitmapType(1) << hinted_id),
|
||||||
std::memory_order_relaxed);
|
std::memory_order_relaxed);
|
||||||
|
|
||||||
if (qsize) {
|
if (qsize) {
|
||||||
@@ -274,15 +277,15 @@ public:
|
|||||||
uint8_t curr = dl.first;
|
uint8_t curr = dl.first;
|
||||||
|
|
||||||
if (in_queues[curr].size())
|
if (in_queues[curr].size())
|
||||||
bitmap |= 1 << curr;
|
bitmap |= BitmapType(1) << curr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
curr = dl.next[curr];
|
curr = dl.next[curr];
|
||||||
if (in_queues[curr].size())
|
if (in_queues[curr].size())
|
||||||
bitmap |= 1 << curr;
|
bitmap |= BitmapType(1) << curr;
|
||||||
} while (curr != dl.last);
|
} while (curr != dl.last);
|
||||||
|
|
||||||
hint.fetch_or(bitmap, std::memory_order_release);
|
hint.fetch_or(bitmap, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t thread_id> std::size_t size() const noexcept {
|
template <std::size_t thread_id> std::size_t size() const noexcept {
|
||||||
|
|||||||
Reference in New Issue
Block a user