Skip to content

Commit

Permalink
Replace Thread.yield() by onSpinWait
Browse files Browse the repository at this point in the history
  • Loading branch information
vbmacher committed Dec 28, 2023
1 parent 1611328 commit ee7dbc5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void preciseSleepNanos(long nanoDuration) {
Thread.currentThread().interrupt();
}
} else if (timeLeft > SPIN_YIELD_PRECISION) {
Thread.yield();
Thread.onSpinWait();
}
timeLeft = end - System.nanoTime();
} while (!Thread.currentThread().isInterrupted() && timeLeft > 0);
Expand Down

0 comments on commit ee7dbc5

Please sign in to comment.