spierce7
10/18/2018, 1:13 PMNSMutableArray
cast to a List<>
in the following object, would this have any problems being frozen shared between threads safely in Kotlin/native?spierce7
10/18/2018, 1:13 PMinternal actual class LockedRef<T> actual constructor(
private val ref: T
) {
internal val lock = NSRecursiveLock()
actual inline fun <R> accessAtomically(block: (T) -> R): R {
lock.lock()
try {
memScoped {
return block(ref)
}
} finally {
lock.unlock()
}
}
}
spierce7
10/18/2018, 1:24 PMinternal class Test() {
val ref = LockedRef<List<Any>>(NSMutableArray() as List<Any>)
init {
freeze()
}
}
svyatoslav.scherbina
10/18/2018, 1:26 PMmemScoped
doesn’t seem to have any effect.spierce7
10/18/2018, 1:31 PMspierce7
10/18/2018, 1:33 PMmemScoped
. Do you still think I can get rid of memScoped
?kpgalligan
10/18/2018, 1:36 PMkpgalligan
10/18/2018, 1:36 PMsvyatoslav.scherbina
10/18/2018, 1:43 PMmemScoped
is completely unrelated to any reference counting.kpgalligan
10/18/2018, 1:44 PMkpgalligan
10/18/2018, 1:45 PMkpgalligan
10/18/2018, 1:58 PMkpgalligan
10/18/2018, 1:59 PMkpgalligan
10/18/2018, 1:59 PMkpgalligan
10/18/2018, 1:59 PMkpgalligan
10/18/2018, 2:00 PMsvyatoslav.scherbina
10/18/2018, 2:00 PMTest
class here: https://kotlinlang.slack.com/archives/C3SGXARS6/p1539869065000100?thread_ts=1539868392.000100&cid=C3SGXARS6kpgalligan
10/18/2018, 2:01 PMsvyatoslav.scherbina
10/18/2018, 2:01 PMkpgalligan
10/18/2018, 2:04 PMkpgalligan
10/18/2018, 2:04 PMkpgalligan
10/18/2018, 2:05 PMkpgalligan
10/18/2018, 2:05 PMkpgalligan
10/18/2018, 2:07 PMkpgalligan
10/18/2018, 2:07 PMkpgalligan
10/18/2018, 2:08 PMolonho
10/18/2018, 2:09 PMAtomicReference<DetachedObjectGraph<T>>
kpgalligan
10/18/2018, 2:09 PMkpgalligan
10/18/2018, 2:09 PMolonho
10/18/2018, 2:10 PMkpgalligan
10/18/2018, 2:10 PMolonho
10/18/2018, 2:10 PMkpgalligan
10/18/2018, 2:10 PMolonho
10/18/2018, 2:11 PMolonho
10/18/2018, 2:12 PMolonho
10/18/2018, 2:12 PMkpgalligan
10/18/2018, 2:13 PMspierce7
10/18/2018, 2:14 PMolonho
10/18/2018, 2:15 PMspierce7
10/18/2018, 2:15 PMolonho
10/18/2018, 2:17 PMspierce7
10/18/2018, 2:24 PMkpgalligan
10/18/2018, 2:25 PMspierce7
10/18/2018, 2:26 PMkpgalligan
10/18/2018, 2:26 PMkpgalligan
10/18/2018, 2:26 PMkpgalligan
10/18/2018, 2:27 PMspierce7
10/18/2018, 2:27 PMkpgalligan
10/18/2018, 2:27 PM