Helu, 

Assume I wish to define a macro MP::WITH-PROCESS-LOCK which expands
into MP:WITH-LOCK-HELD. 

So I put this in a file

 (in-package "CL-USER")
 (ext:without-package-locks
  (defmacro mp::with-process-lock ((lock) &body body)
       `(mp:with-lock-held (,lock) ,@body)))

but it just doesn't work -- not if you compile it, not if you load it,
or eval it at the repl, even if you intern WITH-PROCESS-LOCK in MP
beforehand. The package lock system just won't let you do it.

Isn't this a bug? Since the form _is_ enclosed in a
WITHOUT-PACKAGE-LOCKS?


The workaround is to import CL-USER:WITHOUT-PACKAGE-LOCK into MP

  (in-package "CL-USER")
  (without-package-locks
    (let ((x (intern "WITH-PROCESS-LOCK")))
      (import (list x) :mp)
      (export (list x) :mp)))
  (defmacro mp:with-process-lock ((lock) &body body)
    `(mp:with-lock-held (,lock) ,@body))


This time there is no need for a WITHOUT-PACKAGE-LOCKS.  The package lock
system won't complain at all. Even though you are defining a macro on
MP:WITH-PROCESS-LOCK which is in MP, a locked package!


What am I missing? I'd appreciate it if someone could let me know.

--
Thanks
Madhu


Reply via email to