Skip to content

Commit

Permalink
Optimize Thread Wait Logic in BlockableEventLoop (#69)
Browse files Browse the repository at this point in the history
* Should fix MC-183518
  • Loading branch information
HaHaWTH authored Jun 15, 2024
1 parent d7fcb32 commit 090f29e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions patches/server/0085-Fix-MC-183518.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <[email protected]>
Date: Fri, 14 Jun 2024 17:34:17 -0400
Subject: [PATCH] Fix-MC-183518

Related MC issue: https://bugs.mojang.com/browse/MC-183518

diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
index 43487a9ee202c5b0e5a416519939111f77b3059c..e60d98d1531bc6c962b7cbc3595daa5efa3aed93 100644
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
@@ -142,8 +142,9 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
}

public void waitForTasks() {
- Thread.yield();
- LockSupport.parkNanos("waiting for tasks", 100000L);
+ // Leaf start - Fix MC-183518
+ LockSupport.parkNanos("waiting for tasks", 2000000L);
+ // Leaf end
}

protected void doRunTask(R task) {

0 comments on commit 090f29e

Please sign in to comment.