thread interrupts may violate unwind-protect
Call "run" a few times and you'll notice, that at some point of time there is an attempt to grab the lock by the same process, what means that with-lock may not release *my-lock*
due to the interrupt. If we skip the int process (i.e do not start it), then it never happens. CLX uses extensively locks for using the queue, and condition-wait (as implemented by bt) uses interrupts to enforce timeouts (we do not have them right now in the API).
(defvar *my-lock* (mp:make-lock :name "my lock"))
(defun take-and-release ()
(loop
(print `("take-and-release" ,(mp:process-name mp:*current-process*)))
(mp:with-lock (*my-lock*)
(loop for i from 0 to (expt 2 23)))))
(defun interrupter ()
(print `("interrupt" ,(mp:process-name mp:*current-process*))))
(defun run ()
(let* ((p1 (mp:process-run-function "runner1" #'take-and-release))
(p2 (mp:process-run-function "runner2" #'take-and-release))
(int (mp:process-run-function
"interrupter"
(lambda ()
(loop
(sleep 0.01)
(mp:interrupt-process p1 #'interrupter)
(sleep 0.01)
(mp:interrupt-process p2 #'interrupter))))))
(sleep 10)
(mp:process-kill int)
(mp:process-kill p1)
(mp:process-kill p2)
(print "DONE")
(mp:lock-owner *my-lock*)))