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