Skip to content

Commit 22c5391

Browse files
committed
Fix the segfault
1 parent b017cca commit 22c5391

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: kotlinx-coroutines-core/native/src/DefaultDelay.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,5 @@ private fun defaultDelayRunningUnconfinedLoop(): Nothing {
9898

9999
/** A view separate from [Dispatchers.IO].
100100
* [Int.MAX_VALUE] instead of `1` to avoid needlessly using the [LimitedDispatcher] machinery. */
101-
private val ioView = Dispatchers.IO.limitedParallelism(Int.MAX_VALUE)
101+
private val ioView by lazy { Dispatchers.IO.limitedParallelism(Int.MAX_VALUE) }
102+
// Without `lazy`, there is a cycle between `ioView` and `DefaultDelay` initialization, leading to a segfault.

0 commit comments

Comments
 (0)