Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped and in_place waitable tasklists #920

Open
HeroicKatora opened this issue Feb 21, 2022 · 0 comments
Open

Scoped and in_place waitable tasklists #920

HeroicKatora opened this issue Feb 21, 2022 · 0 comments

Comments

@HeroicKatora
Copy link

Separated from: image-rs/jpeg-decoder#227

The problem is as followed, as part of decoding work we spawn a bunch of tasks. These tasks must communicate their results back when collected but crucially, tasks do not complete in a lexical manner but as separate groups where sometimes their results must be utilized for further work—with this decision depending on data that is only available after such tasks are being spawned and thus this work happens as a separate task.

This implies it is not feasible to wrap the entire thing in a scope to perform that waiting. The only guaranteed synchronization point is after the lexcial end of the scope. The current situation is that this leads to deadlock: The work coordination happens in the main thread but it can never pick-up any work itself. None of scope, scope_fifo, spawn can be utilized for this as they either (a) do not wait on the tasks that had been spawn non-lexically or (b) can't 'block' to return a value to the scope.

What I'd like to have is an API similar to Scope, except I can pre-emptively consume the scope to perform an in-place wait Avoiding a deadlock because the current thread can always be used as a fallback to perform the tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant