cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
19 stars 3 forks source link

Consider passing an env with the current execution context to start/set_xxx methods #240

Closed lewissbaker closed 3 months ago

lewissbaker commented 4 months ago

Sometimes an operation will need to do different things depending on which execution context the prior operation completes on. However there isn't currently an easy way to determine which context you completed on.

The get_completion_scheduler() query only lets you report a single scheduler which doesn't help if an operation could potentially complete on one of several different schedulers. e.g. when_all() could complete on any of the contexts of the input senders.

One avenue that may be worth exploring is having execution contexts explicitly pass information about the current context to start() and also to set_value, etc. methods. This way these operations can know on what context they are starting/completing by querying the environment for the scheduler.

The beginnings of a prototype exploring this idea can be found here: https://godbolt.org/z/537dcerjo

There are a number of outstanding problems a potential design here would need to solve, however.

lewissbaker commented 3 months ago

I think this is too big a change to be making at this stage, even if we had a mature design ready and proven out (which we don't). Closing as wont-fix.