aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/concurrent-executor/util.js
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-02-15 13:37:36 +0100
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2016-02-18 11:23:14 +0000
commita7b5a89919dc972dd38187fce78757cea1de0182 (patch)
treeda09ac869acac1a5a7b5a98d1aa7845897e3718f /tests/auto/blackbox/testdata/concurrent-executor/util.js
parentf4642e9f51dcb29961e586d3195f1334d1f8cb19 (diff)
Fix unwanted "concurrency" in Executor.v1.4.51.4
Script engine evaluation is interrupted once a second to check for cancel requests. At this time, jobs can finish, leading to the onJobFinished() slot being called while we are in the middle of executeRuleNode(). Possible effects: - The job that just finished was the only currently running one, and its transformer outputs have no parents. Then the Executor will think it's done, and higher-level code will free the evaluation context (and with it the engine). When script execution continues after the current round of events processing, a null pointer or freed memory will be accessed. - The job's transformer outputs do have parent artifacts. In this case, we are suddenly and most unexpectedly in executeRuleNode() twice, with the potential for all kinds of stunning behavior. Fix the problem by checking in the onJobFinished() slot whether the rules evaluation context is currently active and delaying slot execution if it is. Task-number: QBS-932 Change-Id: I03ca4f4ad844357e49d5acaddff066395a7f95cf Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/blackbox/testdata/concurrent-executor/util.js')
-rw-r--r--tests/auto/blackbox/testdata/concurrent-executor/util.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/concurrent-executor/util.js b/tests/auto/blackbox/testdata/concurrent-executor/util.js
new file mode 100644
index 000000000..a37a8cbb1
--- /dev/null
+++ b/tests/auto/blackbox/testdata/concurrent-executor/util.js
@@ -0,0 +1,8 @@
+function sleep(timeInMs)
+{
+ var referenceTime = new Date();
+ var time = null;
+ do {
+ time = new Date();
+ } while (time - referenceTime < timeInMs);
+}