From c516d8d4ab7a5560061cb3cd3c1a7ef36984cc59 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Tue, 4 Feb 2014 16:55:57 +0100 Subject: [PATCH] Fix potential synchronization issue in Spawner --- .../utils/org/eclipse/cdt/utils/spawner/Spawner.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/Spawner.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/Spawner.java index c8f66f41118..c003698ebf9 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/Spawner.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/Spawner.java @@ -483,19 +483,21 @@ public class Spawner extends Process { @Override public void run() { + int _pid; try { - pid = execute(fCmdarray, fEnvp, fDirpath, fChannels); + _pid = execute(fCmdarray, fEnvp, fDirpath, fChannels); } catch (Exception e) { - pid = -1; + _pid = -1; fException= e; } // Tell spawner that the process started. synchronized (Spawner.this) { + pid = _pid; Spawner.this.notifyAll(); } - if (pid != -1) { + if (_pid != -1) { // Sync with spawner and notify when done. status = waitFor(pid); synchronized (Spawner.this) {