| 10 | MAX(4); |
| 11 | |
| 12 | fun toThreadPriority(): Int { |
| 13 | val qosClassRatio = value.toDouble() / MAX.value.toDouble() |
| 14 | val threadPriorityOffset = (Thread.MAX_PRIORITY - Thread.MIN_PRIORITY).toDouble() * qosClassRatio |
| 15 | val threadPriority = Thread.MIN_PRIORITY + threadPriorityOffset.roundToInt() |
| 16 | |
| 17 | return Math.min(Math.max(threadPriority, Thread.MIN_PRIORITY), Thread.MAX_PRIORITY) |
| 18 | } |
| 19 | |
| 20 | companion object { |
| 21 | @JvmStatic |
no test coverage detected