A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cplusplus/sender-receiver/issues/280 below:

the preconditions on `run_loop::run()` are too strict · Issue #280 · cplusplus/sender-receiver · GitHub

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:

  1. Precondition: state is starting or finishing.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4