Butterfly barrier hangs when `arrive_and_drop`ing multiple times from the same thread.
Closed this issue · 1 comments
brycelelbach commented
#include <barrier>
#include <iostream>
int main() {
constexpr std::size_t n = 2;
std::barrier b(n, [] { std::cout << "phase completed\n"; });
for (std::size_t i = 0; i < n; ++i)
b.arrive_and_drop();
std::cout << "finished arriving and dropping\n";
}
If I compile with -D__BARRIER_NO_BUTTERFLY
, it works fine.
This is on the top of trunk (a8ea4b4).
I ran into this in my demo with multiple threads calling arrive_and_drop
multiple times each.
ogiroux commented
So that's UB. Not a bug.