kotlinx.atomicfu JVM/IR compiler plugin support

Merge-request: KT-MR-6541
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
This commit is contained in:
mvicsokolova
2022-06-26 07:17:06 +00:00
committed by Space
parent eaad75fd52
commit 8053746ae0
62 changed files with 4249 additions and 349 deletions
@@ -1,20 +1,34 @@
import kotlinx.atomicfu.locks.*
import kotlin.test.*
class ReentrantLockTest {
//class ReentrantLockTest {
// private val lock = reentrantLock()
// private var state = 0
//
// fun testLockField() {
// lock.withLock {
// state = 1
// }
// assertEquals(1, state)
// }
//}
class ReentrantLockFieldTest {
private val lock = reentrantLock()
private var state = 0
fun testLockField() {
fun testLock() {
lock.withLock {
state = 1
}
assertEquals(1, state)
assertTrue(lock.tryLock())
lock.unlock()
}
}
fun box(): String {
val testClass = ReentrantLockTest()
testClass.testLockField()
val testClass = ReentrantLockFieldTest()
testClass.testLock()
return "OK"
}