       }
 
       // Inform the delegate.
-      context.delegateQueue.async {
+      context.delegateQueue.sync {
         context.executorDelegate.jobStarted(job: job, arguments: arguments, pid: pid)
         knownPId.insert(pid)
       }

      // Only inform finished job if the job has been started, otherwise the build
      // system may complain about malformed output
      if (knownPId.contains(pid)) {
        context.delegateQueue.async {
          let result = ProcessResult(
            arguments: [],
            environment: env,

      }

      // Inform the delegate about job finishing.
      context.delegateQueue.sync {
        context.executorDelegate.jobFinished(job: job, result: result, pid: pid)
      }
      context.cancelBuildIfNeeded(result)
