cosync
cosync copied to clipboard
Multiple tasks within a single `Cosync`
I have a use case that requires the following pattern to be possible with cosync:
// Somewhere...
// Task A
cosync.queue(|| async {
do_something().await;
do_another_thing().await;
});
// Task B
cosync.queue(|| async {
do_something().await;
do_another_thing().await;
});
// Elsewhere, every tick...
cosync.run_until_stall(); // this would run both Task A and Task B until they stall
As a practical example of what I am trying to do, imagine a UI that has multiple elements within it, all of which decide they want to move across the screen, and they run that tween through Cosync. I need them all to move across the screen at the same time, but each needs to have its own task.
Sounds good, I can get this done.
It's a bit out of scope of the project, since by definition, this project isn't trying to do that, but ironically, it's architecture trivially allows it to handle that.
It likely be a separate type that's used. CosyncParallel
or something more elegant than that
Okay, check out the branch multi
. Work's still underway, but I'll get it done within the week
closed with #4
looks fantastic, thank you!