1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

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 <tcorbat@hsr.ch>
This commit is contained in:
Thomas Corbat 2016-10-07 09:23:50 +02:00
parent 0459a0ea4d
commit 8416294bb1

View file

@ -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) {
}
}