Hi Bill,<div><br></div><div>Thanks, that makes sens! I was trying to save a reference to an existing lock, when all I wanted was a new lock each time my process started. It's like saving a network connection before restarting the machine :)<br>
<br><div class="gmail_quote">On Thu, Nov 12, 2009 at 5:38 PM, Bill St. Clair <span dir="ltr"><<a href="mailto:billstclair@gmail.com">billstclair@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
As you've discovered, you can't store a lock in a fasl file.<br>
<br>
Try this instead:<br>
<div class="im"><br>
(defun test-function ()<br>
(macrolet ((test-macro ()<br>
(let ((lock (gensym "lock")))<br>
</div> `(let ((,lock (load-time-value (bordeaux-threads:make-lock))))<br>
(print ,lock)))))<br>
(test-macro)))<br>
<br>
The load-time-value delays the evaluation of the make-lock invocation<br>
until the fasl file is loaded.<br>
<br>
-Bill<br>
<div><div></div><div class="h5"><br>
On Thu, Nov 12, 2009 at 10:20 AM, Valentin Baciu <<a href="mailto:valentin@syntactic.org">valentin@syntactic.org</a>> wrote:<br>
> Hello,<br>
> I am using CCL (Version 1.4-r13166M (WindowsX8632)) and cannot compile the<br>
> following file:<br>
> ;; (asdf:oos 'asdf:load-op :bordeaux-threads)<br>
> (defun test-function ()<br>
> (macrolet ((test-macro ()<br>
> (let ((lock (gensym "lock")))<br>
> `(let ((,lock ,(bordeaux-threads:make-lock)))<br>
> (print ,lock)))))<br>
> (test-macro)))<br>
> I can load the file using (load "test.lisp"), but when I try to eval<br>
> (compile-file "test.lisp") I get the backtrace reproduced bellow. I guess<br>
> that the error is related to the macro-expansion of 'test-macro being saved<br>
> to the fasl file, but I don't know how to fix it.<br>
> Can't dump #<RECURSIVE-LOCK [ptr @ #x1199AC0] #x9135196> - unknown type<br>
> [Condition of type SIMPLE-ERROR]<br>
> Restarts:<br>
> 0: [RETRY-COMPILE-FILE] Retry compiling #P"d:/tmp/test.lisp"<br>
> 1: [SKIP-COMPILE-FILE] Skip compiling and loading #P"d:/tmp/test.lisp"<br>
> 2: [ABORT] Return to SLIME's top level.<br>
> 3: [ABORT-BREAK] Reset this thread<br>
> 4: [ABORT] Kill this thread<br>
> Backtrace:<br>
> 0: (CCL::FASL-UNKNOWN #<RECURSIVE-LOCK [ptr @ #x1199AC0] #x9135196>)<br>
> 1: (CCL::FASL-SCAN-CLFUN #<Compiled-function TEST-FUNCTION (Non-Global)<br>
> #x91345AE>)<br>
> 2: (CCL::FASL-SCAN ((23 21) (47 #1="d:/tmp/test.lisp") ..))))<br>
> 3: (CCL::FASL-SCAN-FORMS-AND-DUMP-FILE ((23 21) (47 #1="d:/tmp/test.lisp")<br>
> ..))) "d:/tmp/test.wx32fsl" #<CCL::LEXICAL-ENVIRONMENT #x913E1F6>)<br>
> 4: (CCL::%COMPILE-FILE "d:/tmp/test.lisp" "d:/tmp/test.wx32fsl" T NIL NIL<br>
> T T NIL T :DEFER NIL #<BACKEND WIN32 #x85782E6> :DEFAULT NIL 0)<br>
> 5: (COMPILE-FILE #P"d:/tmp/test.lisp" :OUTPUT-FILE #P"d:/tmp/test.wx32fsl"<br>
> :VERBOSE T :PRINT NIL :LOAD T :FEATURES NIL :TARGET :WIN32<br>
> :SAVE-LOCAL-SYMBOLS T :SAVE-DOC-STRINGS T :SAVE-DEFINITIONS NIL :SAVE..<br>
> 6: (#<Anonymous Function #x8BFB046> #<COMPILED-LEXICAL-CLOSURE #x913EC66>)<br>
> 7: ((:INTERNAL SWANK:COMPILE-FILE-FOR-EMACS))<br>
> 8: (SWANK::MEASURE-TIME-INTERVAL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL<br>
> SWANK:COMPILE-FILE-FOR-EMACS) #x90BA186>)<br>
> 9: (SWANK::COLLECT-NOTES #<COMPILED-LEXICAL-CLOSURE (:INTERNAL<br>
> SWANK:COMPILE-FILE-FOR-EMACS) #x90BA186>)<br>
> 10: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<COMPILED-LEXICAL-CLOSURE<br>
> (:INTERNAL SWANK:COMPILE-FILE-FOR-EMACS) #x90BA1B6>)<br>
> 11: (CCL::CALL-CHECK-REGS SWANK:COMPILE-FILE-FOR-EMACS "d:/tmp/test.lisp" T<br>
> NIL)<br>
> 12: (SWANK::EVAL-FOR-EMACS (SWANK:COMPILE-FILE-FOR-EMACS "d:/tmp/test.lisp"<br>
> T 'NIL) "COMMON-LISP-USER" 65)<br>
> 13: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD))<br>
> 14: (#<Anonymous Function #x8C07576> #<Compiled-function<br>
> SWANK:SWANK-DEBUGGER-HOOK #x8CC696E> #<Compiled-function (:INTERNAL<br>
> SWANK::SPAWN-WORKER-THREAD) (Non-Global) #x8C552D6>)<br>
> 15: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* .<br>
> #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x8D2422E>) (*STANDARD-INPUT* .<br>
> #<SWANK-BACKEND::SLIME-INPUT-STREAM #x8D24466>) ..)))<br>
> #<COMPILED-LEXICAL-CLOSURE (..<br>
> 16: (SWANK::CALL-WITH-CONNECTION #<CONNECTION #x8D053BE><br>
> #<Compiled-function (:INTERNAL SWANK::SPAWN-WORKER-THREAD) (Non-Global)<br>
> #x8C552D6>)<br>
> 17: (SWANK::CALL-WITH-BINDINGS NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL<br>
> SWANK::SPAWN-WORKER-THREAD) #x90BA426>)<br>
> 18: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS worker(28) [Active] #x90B4C3E><br>
> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION)<br>
> #x90B4AFE>))<br>
> 19: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS<br>
> worker(28) [Active] #x9002276> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL<br>
> CCL::%PROCESS-RUN-FUNCTION) #x9002136>))<br>
> 20: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))<br>
><br>
</div></div>> _______________________________________________<br>
> Openmcl-devel mailing list<br>
> <a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
> <a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
><br>
><br>
</blockquote></div><br></div>