From 9f8ae54c818398ae02a6aacdf3b062c2bcabf2b4 Mon Sep 17 00:00:00 2001 From: Heiko Klare Date: Mon, 18 Dec 2023 18:46:29 +0100 Subject: [PATCH] Simplify AsynchExecThread to avoid duplicate barrier state upgrade --- .../core/tests/runtime/jobs/AsynchExecThread.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java b/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java index 5e7fdaca5b7..19d21fd8646 100644 --- a/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java +++ b/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/AsynchExecThread.java @@ -49,17 +49,13 @@ public void run() { //must have positive work current.beginTask(jobName, 1); - try { - if (current.isCanceled()) { - barrier.upgradeTo(TestBarrier2.STATUS_DONE); - job.done(Status.CANCEL_STATUS); - } - current.worked(1); - } finally { - barrier.upgradeTo(TestBarrier2.STATUS_DONE); - current.done(); + if (current.isCanceled()) { + job.done(Status.CANCEL_STATUS); + } else { job.done(Status.OK_STATUS); } + barrier.upgradeTo(TestBarrier2.STATUS_DONE); + current.done(); } }