Rob Elliot
03/23/2021, 11:52 AMlateinit var
on the JVM on a field on an object used from more than one thread do you also need @Volatile
to prevent other threads seeing it as null, or do you get that for free?Rob Elliot
03/25/2021, 9:08 AM@Volatile
for free, so if you want to use a lateinit var
field in a class that will be used from multiple threads you need to mark it as @Volatile
manually.