problem
the precondition on run_loop::run() is that the state is starting. given that run_loop::finish() puts the loop in the finishing state, the implication is that one cannot call finish() before calling run().
However, in most cases sync_wait is calling finish() on its run_loop before calling run(), violating this precondition. sync_wait does the following:
run_loop loop;
auto op = connect(sndr, sync_wait_receiver{&loop});
start(op);
loop.run();
if sndr completes synchronously, the sync_wait_receiver will call finish() on the loop before loop.run() is called, violating run's precondition.
proposed resolution
the precondition on run_loop::run should be:
- Precondition: state is starting or finishing.
problem
the precondition on
run_loop::run()is that the state is starting. given thatrun_loop::finish()puts the loop in the finishing state, the implication is that one cannot callfinish()before callingrun().However, in most cases
sync_waitis callingfinish()on itsrun_loopbefore callingrun(), violating this precondition.sync_waitdoes the following:if
sndrcompletes synchronously, thesync_wait_receiverwill callfinish()on theloopbeforeloop.run()is called, violatingrun's precondition.proposed resolution
the precondition on
run_loop::runshould be: