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.
This commit is contained in:
Marius Gerbershagen 2020-08-29 19:51:58 +02:00
parent 2dce0dabdb
commit 579a8d4380

View file

@ -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 ()))