[slime-devel] Re: Use of with-lock inside without-interrupts

Helmut Eller heller at common-lisp.net
Wed Aug 6 14:30:29 UTC 2008


* Nikodemus Siivola [2008-08-06 13:35+0200] writes:

> In SBCL The Right Thing would be:
>
>  (let (got-it)
>    (without-interrupts
>      (unwind-protect
>          (when (setf got-it (allow-with-interrupts (get-mutex lock)))
>             ...frob-queue...)
>        (when got-it
>          (release-lock lock)))))
>
> and GET-LOCK has the wait wrapped in WITH-INTERRUPTS.

You meant GET-MUTEX, right?

> WITH-INTERRUPTS enabled interrupts only if there is an active
> ALLOW-WITH-INTERRUPTS lexically nested inside each WITHOUT-INTERRUPTS
> currently on stack. (This is what I was trying to explain while
> slightly too drunk to make a great deal of sense.)

Would the following also work?

 (without-interrupts (allow-with-interrupts (with-mutex (lock) ...)

Assuming that WITH-MUTEX expands to the ordinary
GET-MUTEX/RELEASE-MUTEX pair.

Helmut.




More information about the slime-devel mailing list