-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize Thread Wait Logic in BlockableEventLoop (#69)
* Should fix MC-183518
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
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
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) { |