X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2FOperationQueue.java;fp=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2FOperationQueue.java;h=48b891f0ef4215926adb8f06b099b78e07874630;hb=63bb6d595c37b3a2fb55e07fb810779cae3b4d03;hp=7a9d8aba23f1b714d190a92552f879066775a94e;hpb=26b755c7e98b7bb3d9038abba139bef0e71f6607;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..48b891f0e 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java @@ -157,18 +157,23 @@ 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(); + mainProgram.assertMainProgramThread(); - // One last check within the monitor - if(!operations.isEmpty() || !tasks.isEmpty()) return; + // One last check within the monitor + if(!operations.isEmpty() || !tasks.isEmpty()) return 0; - try { - wait(5000); - } catch (InterruptedException e) { - LOGGER.error("Unexpected interruption", e); - } + long start = System.nanoTime(); + System.err.println("start =" + start); + + try { + wait(5000); + } catch (InterruptedException e) { + LOGGER.error("Unexpected interruption", e); + } + + return System.nanoTime() - start; }