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

Start jobs with different priorities #476

Closed
SUPERCILEX opened this issue Aug 4, 2018 · 2 comments
Closed

Start jobs with different priorities #476

SUPERCILEX opened this issue Aug 4, 2018 · 2 comments

Comments

@SUPERCILEX
Copy link
Contributor

Use case: I have a highly parallelized and computationally intensive series of jobs that completely saturate the default ForkJoinPool for a few dozen seconds. However, I want to notify the user of current progress via a ticker that uses delay. Currently, the ticker gets stuck waiting for all the other jobs to finish before it can proceed because the pool is saturated.

Workaround: create a seperate single thread dispatcher that does its own thing. This isn't a bad solution, but it took me a half-hour to figure out why the default dispatcher wasn't working.

@fvasco
Copy link
Contributor

fvasco commented Aug 4, 2018

The workaround is not a workaround, it is a know issue.
#261 can help your use case.

The workaround is to use yield function sometimes to resume others coroutines.

See also: https://stackoverflow.com/a/23436125

@SUPERCILEX
Copy link
Contributor Author

Oh I see, #79 should address this use case.

PS: I don't think #261 will affect me because I'm explicitly creating a new thread: Executors.newFixedThreadPool(1).asCoroutineDispatcher().

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

2 participants