From 8416294bb1e1e7435dc88ce78560594916d1cfe6 Mon Sep 17 00:00:00 2001 From: Thomas Corbat Date: Fri, 7 Oct 2016 09:23:50 +0200 Subject: [PATCH] Bug 503036 - "Binary not found" every other launch (via Run As) - Add a family object for identifying the binary runner job - Use the join mechanism of the job manager to ensure all binary runner jobs are finished Change-Id: I8b82bb0c663e5d2a618e3222e4bd5ba7b48b46c4 Signed-off-by: Thomas Corbat --- .../eclipse/cdt/internal/core/model/BinaryRunner.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java index 346a9b70c65..56b08786ea7 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java @@ -86,6 +86,7 @@ public class BinaryRunner { private final Job runnerJob; // final fields don't need synchronization private IOutputEntry[] entries = new IOutputEntry[0]; private boolean isStopped= false; // access to isStopped must be synchronized. + private final static Object BINARY_RUNNER_FAMILY = new Object(); public BinaryRunner(IProject prj) { cproject = CModelManager.getDefault().create(prj); @@ -135,6 +136,11 @@ public class BinaryRunner { } return status; } + + @Override + public boolean belongsTo(Object family) { + return family == BINARY_RUNNER_FAMILY; + } }; job.setPriority(Job.LONG); return job; @@ -153,10 +159,7 @@ public class BinaryRunner { */ public void waitIfRunning() { try { - Job currentJob = Job.getJobManager().currentJob(); - if (currentJob != null && !currentJob.equals(runnerJob)) { - runnerJob.join(); - } + Job.getJobManager().join(BINARY_RUNNER_FAMILY, null); } catch (InterruptedException e) { } }