Created
June 10, 2022 21:05
-
-
Save longshorej/64102233d64e514b94e50d3ab5de5698 to your computer and use it in GitHub Desktop.
scala spin
This file contains 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
def spin(ms: Int): Unit = { | |
val start = System.nanoTime() | |
while ((System.nanoTime() - start) / 1000 / 1000 < ms) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment