]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Wake up Acorn Core Main Program on commit 53/1253/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Wed, 22 Nov 2017 14:19:18 +0000 (16:19 +0200)
committerJussi Koskela <jussi.koskela@semantum.fi>
Thu, 23 Nov 2017 06:57:25 +0000 (08:57 +0200)
Without this fix undo operations take up to 5 seconds.

refs #7635

Change-Id: I5e1d5d05d27544f2c30a2d31cf038ce1a8a64e86

bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java

index c69c7bea6fe7957bf3c408256a6d9f5cbfed16e4..ecc9649f3b550054d0cd60220ad74a016c2d4337 100644 (file)
@@ -128,7 +128,7 @@ public class MainProgram implements Runnable, Closeable {
                                                try {
                                                        long start = System.nanoTime();
                                                        mutex.release();
                                                try {
                                                        long start = System.nanoTime();
                                                        mutex.release();
-                                                       MainProgram.this.wait(5000);
+                                                       MainProgram.this.wait(5000); // wake up when new operations are scheduled or the last operation is committed  
                                                        mutex.acquire();
                                                        if (!alive)
                                                                break main;
                                                        mutex.acquire();
                                                        if (!alive)
                                                                break main;
@@ -322,7 +322,10 @@ public class MainProgram implements Runnable, Closeable {
             LOGGER.error("Trying to commit operation after MainProgram is closed! Operation is " + last);
 //          return;
         }
             LOGGER.error("Trying to commit operation after MainProgram is closed! Operation is " + last);
 //          return;
         }
-               if(last != null) last.commit();
+               if(last != null) {
+                       last.commit();
+                       notifyAll();
+               }
 
        }
 
 
        }