Hard
std::atomic<bool>::wait with a set-notify-reset pulse
main() starts waiter() and then pulser() on two threads and joins both. pulser() means to 'fire' the signal once and then reset it for the next round. Per the C++20 standard, what is guaranteed about waiter()?
main.cpp
std::atomic<bool> signal{false};
void waiter() {
signal.wait(false); // block while signal == false
std::puts("woke");
}
void pulser() {
signal.store(true);
signal.notify_one();
signal.store(false); // reset for the next round
}44 of 51 in Concurrency