kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Fix misleading documentation comment for Dispatchers.IO
trafficstars
Problem
The documentation for Dispatchers.IO appears to be misleading.
Specifically, it suggests that the kotlinx.coroutines.io.parallelism system property limits the number of threads, when in fact:
- The
kotlinx.coroutines.io.parallelismproperty controls the parallelism limit, not the maximum thread count. - The actual thread pool backing
Dispatchers.IOcan grow up toMAX_POOL_SIZE, which defaults toCoroutineScheduler.MAX_SUPPORTED_POOL_SIZE(2^21 - 2 = 2,097,150threads).
Proposal
Update the comment to clarify that kotlinx.coroutines.io.parallelism controls parallelism (i.e., the number of concurrently scheduled tasks), not the actual number of threads used by the underlying thread pool.