mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
update elem_def.h
This commit is contained in:
parent
d762634380
commit
5a92ea3031
@ -47,7 +47,6 @@ public:
|
|||||||
for (unsigned k = 0;;) {
|
for (unsigned k = 0;;) {
|
||||||
cc_t curr = cc_.load(std::memory_order_acquire);
|
cc_t curr = cc_.load(std::memory_order_acquire);
|
||||||
cc_t next = curr | (curr + 1); // find the first 0, and set it to 1.
|
cc_t next = curr | (curr + 1); // find the first 0, and set it to 1.
|
||||||
if (next == 0) return 0;
|
|
||||||
if (cc_.compare_exchange_weak(curr, next, std::memory_order_release)) {
|
if (cc_.compare_exchange_weak(curr, next, std::memory_order_release)) {
|
||||||
return next ^ curr; // return connected id
|
return next ^ curr; // return connected id
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user