Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlinJVM memory model happens-beforeSingle-choice MCQ

In this classic publication pattern, with `ready` volatile and `data` a plain `Int`, what does the memory model guarantee for the reader thread?

// shared @Volatile var ready = false var data = 0 // writer thread data = 42 ready = true // reader thread if (ready) { println(data) }