diff --git a/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java b/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java index 62bc041c1c5..1e94b90d623 100644 --- a/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java +++ b/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java @@ -907,8 +907,10 @@ protected boolean isBlocking(InternalJob runningJob) { while (previous != null) { // ignore jobs of lower priority (higher priority value means lower priority) if (previous.getPriority() < runningJob.getPriority()) { + if (!previous.isSystem()) + return true; // implicit jobs should interrupt unless they act on behalf of system jobs - if (!previous.isSystem() || (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt())) + if (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt()) return true; } previous = previous.previous(); @@ -953,8 +955,10 @@ protected boolean join(InternalJob job, long timeout, IProgressMonitor monitor) final Semaphore barrier; synchronized (lock) { int state = job.getState(); + if (state == Job.NONE) + return true; //don't join a waiting or sleeping job when suspended (deadlock risk) - if ((state == Job.NONE) || (suspended && state != Job.RUNNING)) + if (suspended && state != Job.RUNNING) return true; //it's an error for a job to join itself if (state == Job.RUNNING && job.getThread() == Thread.currentThread()) @@ -1053,8 +1057,10 @@ public void scheduled(IJobChangeEvent event) { Job job = event.getJob(); if (family == null || job.belongsTo(family)) { // don't add to list if job is being rescheduled + if (((JobChangeEvent) event).reschedule) + return; // if job manager is suspended we only wait for running jobs - if (((JobChangeEvent) event).reschedule || isSuspended()) + if (isSuspended()) return; boolean added = jobs.add(job); assert added;