Skip to content

Instantly share code, notes, and snippets.

@AlexeySoshin
Created May 17, 2020 22: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 AlexeySoshin/e16c5c30b304803720ed97f7d0bfcc14 to your computer and use it in GitHub Desktop.
Save AlexeySoshin/e16c5c30b304803720ed97f7d0bfcc14 to your computer and use it in GitHub Desktop.
for (var i = 0; i < 1_000_000; i++) {
Thread.startVirtualThread(() -> {
c.incrementAndGet();
try {
Thread.sleep(1_000);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment