Created
September 12, 2019 13:28
-
-
Save DeanDonkov/86aa7b07767a270c23ccd51cc8274860 to your computer and use it in GitHub Desktop.
Weird Memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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