https://kotlinlang.org logo
#compose
Title
# compose
m

mcpiroman

06/28/2022, 10:05 AM
Internals: Why does compose not use java.lang.ThreadLocal on JVM, but a custom ThreadLocal implementation?
a

Albert Chang

06/28/2022, 10:20 AM
Compose does use java.lang.ThreadLocal on JVM, just through a wrapper. You can't directly use a JVM-specific class in multiplatform common code.
m

mcpiroman

06/28/2022, 11:08 AM
Ok, it does define an external/actual for ThreadLocal, although I have not found any usage of it. The question should be why a
SnapshotThreadLocal
is there`.` But as I see now it is already documented - it has lower overhead than JVM/ART implementation.
11 Views