Why does this multithreaded C++ program behave unpredictably or hang?
I am trying to optimize a C++20 program by splitting work across 12 threads. The single-threaded version works, but after adding threads and several std::barrier synchronization points, the…