Skip to content

Instantly share code, notes, and snippets.

@LeeHowes
Last active November 11, 2021 01:16
Show Gist options
  • Save LeeHowes/5165f98c58a10c8011e5d5a3775bce06 to your computer and use it in GitHub Desktop.
Save LeeHowes/5165f98c58a10c8011e5d5a3775bce06 to your computer and use it in GitHub Desktop.
~destructor(); // UB if outstanding schedulers are used after destruction. Terminates if there is outstanding work.
spawn(sender)->allocate<sender<Values…>>; // spawns on a scheduler that the async_scope is aware of
spawn_now(sender)->void; // spawns on a scheduler that the async_scope is aware of, blocks until allocate is satisfied
spawn_ignore(sender)->allocate<>. // spawns on a scheduler that the async_scope is aware of. This is the fire and forget version.
async_join()->sender; // name TBD, I find unifex’s names confusing, Kirk doesn't like join though.
async_stop_and_join()->sender; // name TBD, I find unifex’s names confusing, Kirk doesn't like join though.
get_scheduler()->scheduler;
get_stop_token()->stop_token;
?? request_stop() // not clear if that's necessary with the join variant; but unifex has it
?? spawn_call_now(Func)->void; // to allow us to drop execute()
?? spawn_call(Func)->allocate<sender<return type>>; // to allow us to drop execute() consistently, maybe?
?? spawn_call_ignore(Func)->allocate<>; // to allow us to drop execute() consistently, maybe?
@kirkshoop
Copy link

spawn_now(sender)->void; // spawns on a scheduler that the async_scope is aware of, blocks until allocate is satisfied

I think that it is important that spawn_now() is always non-blocking - like the rest. it should throw if the allocation is not immediately successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment