Skip to content

Commit 881cf68

Browse files
authored
Make multithreadingSupported a property with a getter (#3130)
* Make multithreadingSupported a property with a getter This change fixes an issue with the initialization order observed when lazy initialization is disabled (-Xir-property-lazy-initialization= disabled compiler flag) and the new MM is used. The problem is the following: the initialization of DefaultDelay happens before the initialization of multithreadingSupported. Thus the initialization of DefaultDelay gets an uninitialized value of multithreadingSupported and behaves as if the old MM is used. Related issue: #KT-50491.
1 parent ed3445f commit 881cf68

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kotlinx-coroutines-core/native/src/internal/Concurrent.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal open class SuppressSupportingThrowableImpl : Throwable() {
3232
}
3333
}
3434

35-
@SharedImmutable
35+
// getter instead of a property due to the bug in the initialization dependencies tracking with '-Xir-property-lazy-initialization=disabled' that Ktor uses
3636
@OptIn(ExperimentalStdlibApi::class)
37-
internal val multithreadingSupported: Boolean = kotlin.native.isExperimentalMM()
37+
internal val multithreadingSupported: Boolean
38+
get() = kotlin.native.isExperimentalMM()

0 commit comments

Comments
 (0)