Marc Knaup
08/23/2020, 3:53 PMprivate val hash: Int by lazy { … }
but lazy
doesn’t work across threads in Native afaik.Arkadii Ivanov
08/23/2020, 4:19 PMsaket
08/23/2020, 4:56 PMatomicLazy
that you can use
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/atomic-lazy.htmlArkadii Ivanov
08/23/2020, 5:00 PMMarc Knaup
08/23/2020, 5:02 PMlazy
on JVM/JS and atomicLazy
on native 🙂
The part “may potentially leak memory” sounds a bit worrying. But I don’t have cyclical references here so it’s probably OK.
My operations are idempotent, so it’s okay if the lambda is called multiple times.Arkadii Ivanov
08/23/2020, 5:06 PM