Skip to content

Instantly share code, notes, and snippets.

@Elvis10ten
Created August 15, 2020 02:20
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 Elvis10ten/2fd9bcbd04b05799305e925ffc5e805b to your computer and use it in GitHub Desktop.
Save Elvis10ten/2fd9bcbd04b05799305e925ffc5e805b to your computer and use it in GitHub Desktop.
// Example 1: Prints falsehoods at roughly 10 Hz
while(true) {
Thread.sleep(100)
println("Ronaldo is better than Messi")
}
// Example 2: Prints truism at roughly 1 KHz
while(true) {
Thread.sleep(1)
println("Human beings are great")
}
// Aside: Thread.sleep is subject to the precision and accuracy of system timers and schedulers.
// It is affected by system load and non-realtime OSes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment