From schulte.eric at gmail.com Thu Apr 7 17:10:56 2011 From: schulte.eric at gmail.com (Eric Schulte) Date: Thu, 07 Apr 2011 11:10:56 -0600 Subject: [trivial-timeout-devel] clozure cl doesn't recognize dynamic variables Message-ID: <8739lu2di7.fsf@gmail.com> Hi, Using `with-timeout' with Clozure-CL results in the following bug, in which the dynamic value of special variables are not recognized inside of the `with-timeout' macro. #+begin_src common-lisp (defvar *echo* :default) (let ((*echo* :special)) (format t "~&outside echo:~a" *echo*) ;; => outside echo:SPECIAL (with-timeout (1) (format nil "~&inside echo:~a" *echo*))) ;; => "inside echo:DEFAULT" #+end_src Best -- Eric -- Eric Schulte http://cs.unm.edu/~eschulte/ From milanj at gmail.com Thu Apr 7 18:17:59 2011 From: milanj at gmail.com (Milan Jovanovic) Date: Thu, 7 Apr 2011 20:17:59 +0200 Subject: [trivial-timeout-devel] clozure cl doesn't recognize dynamic variables In-Reply-To: <8739lu2di7.fsf@gmail.com> References: <8739lu2di7.fsf@gmail.com> Message-ID: <1DBFC41D-B909-46AD-9657-53B88692F550@gmail.com> Code enclosed with WITH-TIMEOUT on CCL runs in separate thread and this behavior is correct and documented (regarding threads and dynamic environment), SBCL threads and dynamic environment works the same but WITH-TIMEOUT on SBCL is implemented on top of SBCL timers. This is probably bug in trivial-timeout context but i don't think that there is easy&good solution here ... Milan On Apr 7, 2011, at 7:10 PM, Eric Schulte wrote: > Hi, > > Using `with-timeout' with Clozure-CL results in the following bug, in > which the dynamic value of special variables are not recognized inside > of the `with-timeout' macro. > > #+begin_src common-lisp > (defvar *echo* :default) > > (let ((*echo* :special)) > (format t "~&outside echo:~a" *echo*) ;; => outside echo:SPECIAL > (with-timeout (1) > (format nil "~&inside echo:~a" *echo*))) ;; => "inside > echo:DEFAULT" > #+end_src > > Best -- Eric > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > > _______________________________________________ > trivial-timeout-devel mailing list > trivial-timeout-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/trivial-timeout-devel From schulte.eric at gmail.com Thu Apr 7 19:07:31 2011 From: schulte.eric at gmail.com (Eric Schulte) Date: Thu, 07 Apr 2011 13:07:31 -0600 Subject: [trivial-timeout-devel] clozure cl doesn't recognize dynamic variables In-Reply-To: <1DBFC41D-B909-46AD-9657-53B88692F550@gmail.com> (Milan Jovanovic's message of "Thu, 7 Apr 2011 20:17:59 +0200") References: <8739lu2di7.fsf@gmail.com> <1DBFC41D-B909-46AD-9657-53B88692F550@gmail.com> Message-ID: <874o69283w.fsf@gmail.com> Milan Jovanovic writes: > Code enclosed with WITH-TIMEOUT on CCL runs in separate thread and > this behavior is correct and documented (regarding threads and dynamic > environment), SBCL threads and dynamic environment works the same but > WITH-TIMEOUT on SBCL is implemented on top of SBCL timers. > This is probably bug in trivial-timeout context but i don't think > that there is easy&good solution here ... > Thanks for the explanation, that all makes sense, luckily there is an easy enough workaround... #+begin_src lisp (let ((new-value *echo*)) (with-timeout (1) ... new-value ...)) #+end_src -- Eric -- Eric Schulte http://cs.unm.edu/~eschulte/ From gwking at metabang.com Fri Apr 8 13:12:52 2011 From: gwking at metabang.com (Gary King) Date: Fri, 8 Apr 2011 09:12:52 -0400 Subject: [trivial-timeout-devel] clozure cl doesn't recognize dynamic variables In-Reply-To: <874o69283w.fsf@gmail.com> References: <8739lu2di7.fsf@gmail.com> <1DBFC41D-B909-46AD-9657-53B88692F550@gmail.com> <874o69283w.fsf@gmail.com> Message-ID: Hi Eric, I'll try to add a note to the manual about this. the whole idea of timeouts is problematic as multithreading becomes the norm. From my iPhone to you? On Apr 7, 2011, at 3:07 PM, "Eric Schulte" wrote: > Milan Jovanovic writes: > >> Code enclosed with WITH-TIMEOUT on CCL runs in separate thread and >> this behavior is correct and documented (regarding threads and dynamic >> environment), SBCL threads and dynamic environment works the same but >> WITH-TIMEOUT on SBCL is implemented on top of SBCL timers. >> This is probably bug in trivial-timeout context but i don't think >> that there is easy&good solution here ... >> > > Thanks for the explanation, that all makes sense, luckily there is an > easy enough workaround... > > #+begin_src lisp > (let ((new-value *echo*)) > (with-timeout (1) > ... new-value ...)) > #+end_src > > -- Eric > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > > _______________________________________________ > trivial-timeout-devel mailing list > trivial-timeout-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/trivial-timeout-devel