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

Interrupt thread while decoding if coroutine is cancelled. #395

Merged
merged 2 commits into from May 11, 2020

Conversation

colinrtwhite
Copy link
Member

@colinrtwhite colinrtwhite commented May 8, 2020

This allows for much faster cancellation as we can cancel in-flight decode operations.

Fixes #378

Copy link
Member

@Jawnnypoo Jawnnypoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

@Jawnnypoo
Copy link
Member

Do we still need the deferred stuff too?

deferred.invokeOnCompletion { throwable ->

@colinrtwhite
Copy link
Member Author

Do we still need the deferred stuff too?

deferred.invokeOnCompletion { throwable ->

Yep, invokeOnCompletion will still be called if the thread is interrupted. We also still need all the logic in invokeOnCompletion since it handles setting the error drawable, some bitmap pooling work, notifying listeners, etc.

@colinrtwhite
Copy link
Member Author

colinrtwhite commented May 8, 2020

Seeing a performance regression when testing this (related to runInterruptible not 1.3.6). Going to hold off merging for the moment and investigate.

@colinrtwhite colinrtwhite changed the title Interrupt thread while decoding if coroutine is cancelled. Update Coroutines (1.3.6). Interrupt thread while decoding if coroutine is cancelled. May 9, 2020
@colinrtwhite
Copy link
Member Author

I think the performance regression I was seeing on my Pixel 1 was a local config issue and haven't been able to reproduce. Going to merge this in and keep an eye on it.

@colinrtwhite colinrtwhite merged commit a13081d into master May 11, 2020
@colinrtwhite colinrtwhite deleted the colin/interrupt branch May 11, 2020 08:36
colinrtwhite added a commit that referenced this pull request Oct 5, 2022
* Interrupt thread while decoding if coroutine is cancelled. Update Coroutines (1.3.6).

* Guard against adding the same bitmap twice.
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

Successfully merging this pull request may close these issues.

Support thread interruption in cancel
2 participants