https://kotlinlang.org logo
#codereview
Title
# codereview
e

Eduard Boloș

10/13/2022, 10:49 AM
Hello! Is
this::field.isInitialized
considered thread-safe? (
field
is a
lateinit var
). Trying to figure out if I need to make sure the field gets created from the same thread that it's later accessed from, or if I can just rely on
isInitialized
being thread-safe 😄
e

ephemient

10/13/2022, 11:01 AM
no, and even if it were, you'd have a TOCTTOU race
c

czuckie

10/13/2022, 11:21 AM
wait, would you have a TOCTOU? You can't go from initialised to uninitialised can you?
oh, but you can go from uninitialised to initialised doh
3 Views