adjust memory order

This commit is contained in:
mutouyun 2018-11-22 16:49:27 +08:00
parent 8dbc667145
commit 6be8071802

View File

@ -78,7 +78,7 @@ public:
} }
std::size_t conn_count(void) const { std::size_t conn_count(void) const {
return cc_.load(std::memory_order_acquire); return cc_.load(std::memory_order_consume);
} }
void* acquire(void) { void* acquire(void) {
@ -87,7 +87,7 @@ public:
do { do {
std::size_t expected = 0; std::size_t expected = 0;
if (st->head_.compare_exchange_weak(expected, conn_count(), if (st->head_.compare_exchange_weak(expected, conn_count(),
std::memory_order_acquire, std::memory_order_relaxed)) { std::memory_order_consume, std::memory_order_relaxed)) {
break; break;
} }
} while(1); } while(1);
@ -99,7 +99,7 @@ public:
} }
std::uint16_t cursor(void) const { std::uint16_t cursor(void) const {
return cr_.load(std::memory_order_acquire); return cr_.load(std::memory_order_consume);
} }
void* get(std::uint16_t index) { void* get(std::uint16_t index) {