From 579a8d4380a566415c2f020cfc8b4f95eb67c040 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sat, 29 Aug 2020 19:51:58 +0200 Subject: [PATCH] run-program: simplify with-process-lock We already have a race condition between mp:get-lock and mp:holding-lock-p, there is no point in trying to make sure the lock is released at all costs during an interrupt. --- src/lsp/process.lsp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lsp/process.lsp b/src/lsp/process.lsp index 36215c2b0..c9392b61e 100644 --- a/src/lsp/process.lsp +++ b/src/lsp/process.lsp @@ -12,12 +12,11 @@ (ext:with-unique-names (lock wait-p) `(let ((,lock (external-process-%lock ,process)) (,wait-p ,wait)) - (mp:without-interrupts - (unwind-protect (mp::with-restored-interrupts - (when (mp:get-lock ,lock ,wait-p) - (locally ,@body))) - (when (mp:holding-lock-p ,lock) - (mp:giveup-lock ,lock)))))) + (when (mp:get-lock ,lock ,wait-p) + (mp:without-interrupts + (unwind-protect (mp::with-restored-interrupts + (locally ,@body)) + (mp:giveup-lock ,lock)))))) #-threads `(progn ,@body)) (defstruct (external-process (:constructor make-external-process ()))