-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
The ByteString hash function caches previously calculated values. The member variable that stores the cached value is a non-atomic Int
.
I believe that kotlinx-ios hash cache logic was inspired by the google protobuf ByteString hash implementation. But that hash caching has a disclaimer that the non-atomic Int
backing the cache is safe because of JVM memory model semantics.
Is it safe to use a non-atomic Int
for Kotlin native builds? Does the hash cache member variable need to be converted to an Atomic<Int>
for non-JVM platforms?
Metadata
Metadata
Assignees
Labels
No labels