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
Support thread interruption in cancel #378
Comments
Interesting! I think this is a great idea. You're right that Coil currently only uses existing coroutines mechanisms (mostly Looking at the |
KotlinX Coroutines 1.3.6 has been released with |
Reopening this as The issue is we can't interrupt the thread while it's reading from an OkHttp I think we can still support thread interruption during decoding by using a |
Is your feature request related to a problem? Please describe.
I'm working on a file manager with fast scroll support. In a directory with hundreds of images, if the user fast scrolls the list of files, the thumbnail loading isn't as smooth as what Glide used to provide. I think this is because Coil's decoders (mainly
BitmapFactoryDecoder
) isn't getting interrupted upon cancel, which I heard Glide does (viaFuture.cancel(true)
).Describe the solution you'd like
Coil decoders should interrupt its thread upon job cancellation. An implementation of this has been proposed at Kotlin/kotlinx.coroutines#1947, however I'm not sure when it will land, so maybe we should also consider rolling our own since this is important for smooth image loading.
Additional context
I didn't find any usage of
Future
orinterrupt
in this project, and I also looked atBitmapFactoryDecoder
where I didn't find anything special, so I'm assuming that the current Coil job cancellation is just a coroutine cancenllation. Sorry in advance if I overlooked anything, because I'm not a coroutine expert yet.The text was updated successfully, but these errors were encountered: