[question] how do we `bulk` a batch of `senders` ?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.4k
- Forks
- 270
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 39
Description
Suppose we have an async operation:
stdexec::sender auto tcp::socket::async_connect(endpoint);
Now we try to connect a batch of endpoints, and wait for all/any of them.
stdexec::sender auto task_1 = socket_1.async_connect("127.0.0.1:1");
stdexec::sender auto task_2 = socket_2.async_connect("127.0.0.1:2");
stdexec::sender auto task_3 = socket_3.async_connect("127.0.0.1:3");
/* ... */
stdexec::sender auto task_65535 = socket_65535.async_connect("127.0.0.1:65535");
stdexec::sync_wait(stdexec::when_all(task_1, task_2, task_3, /*...*/, task_65535));
The functions above are all senders instead of synchronous functions (that is, submit task and later callback). Although we can bulk synchronous functions using stdexec::bulk(policy, shape, sync_func), I wonder: is there a function that we can stdexec::/*bulk_what*/(policy, shape, func_who_returns_sender)? I tried hard to read the docs but sadly could not find it.
auto sockets = std::vector<tcp::socket>(65535);
stdexec::sync_wait(stdexec::/*let_bulk_or_some_name_else?*/(
stdexec::par,
65535,
[&] { return sockets[i].async_connect(std::format("127.0.0.1:{}", i); }
)
Thank you!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Start by reading the existing bulk, when_all, and sync_wait documentation and entry points to determine how sender-returning operations are composed; done means documenting whether the requested behavior is already supported or defining a scoped API/design issue if it is not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100