File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
okhttp/src/main/kotlin/okhttp3/internal/concurrent Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import okhttp3.internal.connection.Locks.newLockCondition
3030import okhttp3.internal.connection.Locks.withLock
3131import okhttp3.internal.okHttpName
3232import okhttp3.internal.threadFactory
33+ import okhttp3.internal.threadName
3334
3435/* *
3536 * A set of worker threads that are shared among a set of task queues.
@@ -132,18 +133,15 @@ class TaskRunner(
132133 }
133134
134135 private fun runTask (task : Task ) {
135- val currentThread = Thread .currentThread()
136- val oldName = currentThread.name
137- currentThread.name = task.name
138-
139- var delayNanos = - 1L
140- try {
141- delayNanos = task.runOnce()
142- } finally {
143- this .withLock {
144- afterRun(task, delayNanos)
136+ threadName(task.name) {
137+ var delayNanos = - 1L
138+ try {
139+ delayNanos = task.runOnce()
140+ } finally {
141+ this .withLock {
142+ afterRun(task, delayNanos)
143+ }
145144 }
146- currentThread.name = oldName
147145 }
148146 }
149147
You can’t perform that action at this time.
0 commit comments