Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kotlinx-coroutines-core/jvm/src/Dispatchers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kotlinx.coroutines

import kotlinx.coroutines.internal.*
import kotlinx.coroutines.scheduling.*
import kotlin.coroutines.*

/**
* Name of the property that defines the maximal number of threads that are used by [Dispatchers.IO] coroutines dispatcher.
Expand Down
5 changes: 2 additions & 3 deletions kotlinx-coroutines-core/jvm/src/ThreadPoolDispatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ public actual fun newFixedThreadPoolContext(nThreads: Int, name: String): Execut
require(nThreads >= 1) { "Expected at least one thread, but $nThreads specified" }
val threadNo = AtomicInteger()
val executor = Executors.newScheduledThreadPool(nThreads) { runnable ->
val t = Thread(runnable, if (nThreads == 1) name else name + "-" + threadNo.incrementAndGet())
t.isDaemon = true
t
Thread(runnable, if (nThreads == 1) name else name + "-" + threadNo.incrementAndGet())
.apply { isDaemon = true }
}
return Executors.unconfigurableExecutorService(executor).asCoroutineDispatcher()
}