mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2026-02-06 01:39:47 +08:00
adjust memory order
This commit is contained in:
parent
8dbc667145
commit
6be8071802
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user