Conversation
This prevents the compiler from generating a speculative load of incomplete awaitable paths, which triggers a TSan false positive. It's truly a false positive because the unused result is discarded.
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.
These replace and enhance the old
result_each()overloads (this is a breaking change):tmc::spawn_many().result_each()->tmc::mux_manytmc::spawn_tuple().result_each()->tmc::mux_tupleWhat's the same:
mux_*is an lvalue awaitable that allows you toco_awaitit multiple times. Each time it returns the index of a single ready awaitable, which you can then access withoperator[]/get().co_await mux == mux.end()) before the mux is destroyed.The crucial new feature:
.fork()a new awaitable to replace one that has completed, while other awaitables in the group are still running.tmc::select(), active (not finished) awaitables don't get canceled when a different awaitable completes or is replaced.It also offers:
fork(awaitable, executor, priority).fork_clang()to re-initiate awaitables with HALO, and it works in a loop as long as each is within a switch statement associated with the specific index that it's replacing.is_active()/active_bitset()methods let you track which awaitable slots are live.What's lost from the old
result_each():mux_many().run_on(ex).with_priority(2). If you want to customize the tasks you must construct it empty and thenfork(task, ex, 2)each awaitable.Documentation:
I've also added an AGENTS.md / CLAUDE.md to this repo, for library users. It's fairly lightweight and is just designed to give your agent a headstart when using the library.