From 78ab6155eeafa0e7b4494de3967343921d15eb82 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 14 Apr 2020 02:57:15 +0200 Subject: shortened the code + by using toUpdate as sync object Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../api/threads/GT_Runnable_MachineBlockUpdate.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main/java/gregtech/api/threads') diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index cefbb0bc8d..5e7081e3c2 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -68,9 +68,9 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { GT_Runnable_MachineBlockUpdate.setmWorld(aWorld); GT_Runnable_MachineBlockUpdate.resetVisited(); GT_Runnable_MachineBlockUpdate.setAllowedToRun(true); - synchronized (GT_Runnable_MachineBlockUpdate.INSTANCETHREAD) { + synchronized (toUpdate) { if (GT_Runnable_MachineBlockUpdate.INSTANCETHREAD.getState() == Thread.State.WAITING) - GT_Runnable_MachineBlockUpdate.INSTANCETHREAD.notify(); + GT_Runnable_MachineBlockUpdate.toUpdate.notify(); } } @@ -168,12 +168,10 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { if (coordinates != null) { coordinates.update(); } else { - synchronized(INSTANCETHREAD) { - try { - INSTANCETHREAD.wait(); - } catch (InterruptedException ignored) { - return; - } + try { + toUpdate.wait(); + } catch (InterruptedException ignored) { + return; } } } -- cgit