cosync icon indicating copy to clipboard operation
cosync copied to clipboard

Multiple tasks within a single `Cosync`

Open imlazyeye opened this issue 2 years ago • 1 comments

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.

imlazyeye avatar Mar 04 '22 19:03 imlazyeye

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

sanbox-irl avatar Apr 22 '22 15:04 sanbox-irl

Okay, check out the branch multi. Work's still underway, but I'll get it done within the week

sanbox-irl avatar Feb 05 '23 02:02 sanbox-irl

closed with #4

sanbox-irl avatar Feb 16 '23 04:02 sanbox-irl

looks fantastic, thank you!

imlazyeye avatar Feb 16 '23 13:02 imlazyeye