https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106772
--- Comment #6 from Thomas Rodgers <rodgertq at gcc dot gnu.org> --- (In reply to Mkkt Bkkt from comment #5) > Single reason why I want to use atomic::wait/notify is cross platform api > for futex, wait/wake on address, ulock, etc > Not because I need YOU decide instead of me how many spins, or other > optimization I need. > > boost::atomic already do this. > > Why do you cannot make same? (In reply to Mkkt Bkkt from comment #4) > Nice, thanks for benchmarks without code. > > Also, why do I need call notify when don't have wait? > > Common usage from my point of view looks like: > > atomic.wait(value, mo): > > while (atomic.load(mo) == value) { > futex_wait(); > } > > Notify want to looks like: > > atomic.store(1, mo) > atomic.notify_one(); > > See: > > https://github.com/lewissbaker/cppcoro/blob/master/lib/ > lightweight_manual_reset_event.cpp > I have every confidence that Lewis knows how to bring a paper for a 'lightweight manual reset event' to SG1, I suspect it will be well received when he does. > https://github.com/YACLib/YACLib/blob/main/src/util/atomic_event.cpp > > and others > > So your optimization is pretty useless. > > Also if for some reason possible few notification, or notify before wait, > then possible to have code can looks like: > > if (atomic.exchange(non_wait_value, mo) == wait_value) { > atomic.notify_one(); > } I