mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
try compatible with old compilers
This commit is contained in:
parent
44a9a4b98f
commit
88d9f8b225
@ -115,7 +115,7 @@ void benchmark_prod_cons(T* cq) {
|
||||
// std::cout << cid << "-consumer-disconnect" << std::endl;
|
||||
// }
|
||||
tcq.disconnect(cn);
|
||||
if ((fini_c.fetch_add(1, std::memory_order_relaxed) + 1) != std::extent<decltype(consumers)>::value) {
|
||||
if ((fini_c.fetch_add(1, std::memory_order_relaxed) + 1) != M) {
|
||||
// std::unique_lock<capo::spin_lock> guard { lc };
|
||||
// std::cout << cid << "-consumer-end" << std::endl;
|
||||
return;
|
||||
@ -141,7 +141,7 @@ void benchmark_prod_cons(T* cq) {
|
||||
// }
|
||||
tcq.send(cn, { pid, i });
|
||||
}
|
||||
if ((fini_p.fetch_add(1, std::memory_order_relaxed) + 1) != std::extent<decltype(producers)>::value) {
|
||||
if ((fini_p.fetch_add(1, std::memory_order_relaxed) + 1) != N) {
|
||||
return;
|
||||
}
|
||||
// quit
|
||||
|
||||
@ -265,12 +265,12 @@ void benchmark_lc() {
|
||||
}
|
||||
std::this_thread::yield();
|
||||
}
|
||||
if ((fini.fetch_add(1, std::memory_order_relaxed) + 1) == std::extent<decltype(r_trd)>::value) {
|
||||
if ((fini.fetch_add(1, std::memory_order_relaxed) + 1) == R) {
|
||||
sw.print_elapsed(W, R, Loops);
|
||||
}
|
||||
std::uint64_t sum = 0;
|
||||
for (int i : seq) sum += static_cast<std::uint64_t>(i);
|
||||
QCOMPARE(sum, acc<std::uint64_t>(1, Loops) * std::extent<decltype(w_trd)>::value);
|
||||
QCOMPARE(sum, acc<std::uint64_t>(1, Loops) * W);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user