[K/N] Tests for volatile

^KT-54944
This commit is contained in:
Pavel Kunyavskiy
2022-11-30 18:28:47 +01:00
committed by Space Team
parent a11f6fd9cb
commit fc95b88eef
22 changed files with 1029 additions and 0 deletions
@@ -0,0 +1,26 @@
// TARGET_BACKEND: NATIVE
// test is disabled now because of https://youtrack.jetbrains.com/issue/KT-55426
// IGNORE_BACKEND: NATIVE
// MODULE: lib
// FILE: lib.kt
@file:OptIn(kotlin.ExperimentalStdlibApi::class)
import kotlin.native.concurrent.*
import kotlin.concurrent.*
class Box(@Volatile var value: String)
// MODULE: main(lib)
// FILE: main.kt
@file:Suppress("INVISIBLE_MEMBER")
import kotlin.native.concurrent.*
import kotlin.concurrent.*
fun box() : String {
val o = "O"
val x = Box(o)
return x.compareAndSwapField(Box::value, o, "K") + x.value
}