]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java
MainProgram polls nanoTime too often
[simantics/platform.git] / bundles / org.simantics.acorn / src / org / simantics / acorn / OperationQueue.java
index 7a9d8aba23f1b714d190a92552f879066775a94e..a85aa882930446b6214e4bd5116b8e3358233930 100644 (file)
@@ -157,18 +157,20 @@ class OperationQueue {
         * Wake up when new operations are scheduled or the last operation is committed
         * Called by MainProgram thread
         */
-       synchronized void waitFor() {
+       synchronized long waitFor() {
 
                mainProgram.assertMainProgramThread();
 
                // One last check within the monitor 
-               if(!operations.isEmpty() || !tasks.isEmpty()) return;
+               if(!operations.isEmpty() || !tasks.isEmpty()) return 0;
 
+               long start = System.nanoTime();
                try {
                        wait(5000);
                } catch (InterruptedException e) {
                        LOGGER.error("Unexpected interruption", e);
                }
+               return System.nanoTime() - start;
 
        }