A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue4150 below:

Issue 4150: The preconditions on run_loop::run() are too strict

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

4150. The preconditions on run_loop::run() are too strict

Section: 33.12.1.4 [exec.run.loop.members] Status: Resolved Submitter: Eric Niebler Opened: 2024-09-05 Last modified: 2025-02-07

Priority: Not Prioritized

View all issues with Resolved status.

Discussion:

From sender-receiver/issues #280:

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.

[2025-02-07 Status changed: New → Resolved.]

Resolved by P3396R1.

Proposed resolution:

This wording is relative to N4988.

  1. Modify 33.12.1.4 [exec.run.loop.members] as indicated:

    void run();
    

    -5- Preconditions: state is starting or finishing.

    -6- Effects: Sets the state to running. Then, equivalent to:
    while (auto* op = pop-front()) {
      op->execute();
    }
    

    -7- Remarks: When state changes, it does so without introducing data races.


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