X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2FOperationQueue.java;h=d48f9ba6da792f6c292f1ac4ac14cf01aaadbd95;hb=refs%2Fheads%2Fprivate%2Fantti2;hp=7a9d8aba23f1b714d190a92552f879066775a94e;hpb=751ee12501d220832b672dd433655a4d65806fd9;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java index 7a9d8aba2..d48f9ba6d 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java @@ -157,19 +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; } - }