mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Slightly better practice because wait can be randomly interupted.
This commit is contained in:
1 parent
4248dbc71d
commit
42404c531d
1 file changed
+11
-8
@@ -45,17 +45,20 @@ public class ChunkIOExecutor
|
||||
ChunkIOProvider task = tasks.get(key);
|
||||
if (task != null)
|
||||
{
|
||||
if (!pool.remove(task) && !task.runFinished()) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
|
||||
if (!pool.remove(task)) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
|
||||
{
|
||||
synchronized(task)
|
||||
while (!task.runFinished())
|
||||
{
|
||||
try
|
||||
synchronized(task)
|
||||
{
|
||||
task.wait();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace(); // Something happened? Log it?
|
||||
try
|
||||
{
|
||||
task.wait();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace(); // Something happened? Log it?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user