Repository navigation
Make start_now's request_stop reach its senders - #2417
Open
Nas01010101 wants to merge 1 commit into
Open
Nas01010101 wants to merge 1 commit into
Nas01010101 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2416
__scope.nest()replaces the stop token in the receiver's environment with the scope's token, so a stop request on thestart_nowstorage never reached the senders.This change wraps each sender in
__stop_whenwith the storage's token before nesting it. The sender then responds to both the storage and the scope.__counting_scopes.hppand__spawn_future.hppuse__stop_whenthe same way.Tests
Added to
test/exec/async_scope/test_start_now.cpp:start_now request_stop stops the sendersfails without the change instart_now.hpp.start_now senders still stop with the scopepasses with and without it, and covers the scope's stop request.test_start_now.cppis the only file that includesstart_now.hpp. That test file passes on:-O0 -Wall -Wextra -Werror-O0 -fsanitize=address,undefined-O1 -fsanitize=thread-O2 -std=c++23-O0-O0 -fsanitize=address-O2 -std=c++23A separate program stopped a sender running on
static_thread_pool, 300 times through the storage and 300 times through the scope, with no reports under TSan or ASan/UBSan.test.execbuilt with CMake (clang 21.1.8, Debug, C++20) passes all 507 test cases. libc++ and nvc++ were not run locally.