Skip to content

Commit

Permalink
BitmapHunter resets Thread's name to original name (#2407)
Browse files Browse the repository at this point in the history
  • Loading branch information
gamepro65 committed Jul 5, 2023
1 parent 8205c9d commit f547f0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.squareup.picasso3.MemoryPolicy.Companion.shouldReadFromMemoryCache
import com.squareup.picasso3.Picasso.LoadedFrom
import com.squareup.picasso3.RequestHandler.Result.Bitmap
import com.squareup.picasso3.Utils.OWNER_HUNTER
import com.squareup.picasso3.Utils.THREAD_IDLE_NAME
import com.squareup.picasso3.Utils.THREAD_PREFIX
import com.squareup.picasso3.Utils.VERB_DECODED
import com.squareup.picasso3.Utils.VERB_EXECUTING
Expand Down Expand Up @@ -64,6 +63,7 @@ internal open class BitmapHunter(
get() = future?.isCancelled ?: false

override fun run() {
val originalName = Thread.currentThread().name
try {
updateThreadName(data)

Expand All @@ -84,7 +84,7 @@ internal open class BitmapHunter(
exception = e
dispatcher.dispatchFailed(this)
} finally {
Thread.currentThread().name = THREAD_IDLE_NAME
Thread.currentThread().name = originalName
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PicassoExecutorService(

private class PicassoThread(r: Runnable) : Thread(r) {
override fun run() {
name = Utils.THREAD_IDLE_NAME
Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND)
super.run()
}
Expand Down

0 comments on commit f547f0b

Please sign in to comment.