Skip to content

Commit

Permalink
change: remove spin-waiting for IO threads
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Nov 28, 2024
1 parent 5379300 commit 41f4462
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public void run() {
this.closeFuture.complete(null);
break;
} else {
// attempt to spin-wait before sleeping
if (!pollTasks()) {
Thread.interrupted(); // clear interrupt flag
for (int i = 0; i < 5000; i ++) {
if (pollTasks() || this.closing.get()) continue main_loop;
LockSupport.parkNanos("Spin-waiting for tasks", 10_000); // 100us
}
}
// // attempt to spin-wait before sleeping
// if (!pollTasks()) {
// Thread.interrupted(); // clear interrupt flag
// for (int i = 0; i < 5000; i ++) {
// if (pollTasks() || this.closing.get()) continue main_loop;
// LockSupport.parkNanos("Spin-waiting for tasks", 10_000); // 100us
// }
// }
synchronized (sync) {
if (this.taskSize.get() != 0 || this.closing.get()) continue main_loop;
try {
Expand Down

0 comments on commit 41f4462

Please sign in to comment.