Skip to content

Instantly share code, notes, and snippets.

@DeanDonkov
Created September 12, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeanDonkov/86aa7b07767a270c23ccd51cc8274860 to your computer and use it in GitHub Desktop.
Save DeanDonkov/86aa7b07767a270c23ccd51cc8274860 to your computer and use it in GitHub Desktop.
Weird Memory
object TestThreadClientMode {
private var done: Boolean = false
@Throws(InterruptedException::class)
@JvmStatic
fun main(args: Array<String>) {
Thread(Runnable {
var count = 0
while (!done) {
count++
println(count);
}
println("Done! " + Thread.currentThread().name + " " + done)
}).start()
println("OS: " + System.getProperty("os.name"))
Thread.sleep(1000)
done = true
println("flag done set true ")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment