From 3c79b7539df941abd2ec5c49407701f110263977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Mon, 21 Nov 2022 08:26:05 +0100 Subject: [PATCH] fix race condition Job.run() with IJobChangeEvent.running() #271 The abbreviation check eventQueueThread.isEmpty() can become true before all events processed. Need to have a lock before doing the check. --- .../src/org/eclipse/core/internal/jobs/JobListeners.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java b/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java index afb80afe5e7..0290791d2f2 100644 --- a/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java +++ b/runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobListeners.java @@ -61,7 +61,7 @@ void waitAndSendEvents(InternalJob job, boolean shouldSend) { boolean send = shouldSend || job.eventQueueLock.isHeldByCurrentThread(); // Synchronize eventQueue to get a stable order of events across Threads. // There is however no guarantee in which Thread the event is delivered. - while (!job.eventQueue.isEmpty()) { + while (true) { if (getJobListenerTimeout() == 0) { // backward compatibility mode for listeners that may deadlock if (send) {