[hunchentoot-devel] printing to *standard-output* in a multithreaded environment

I wonder is it save to have a macro like this: (defmacro with-html (&body body) `(with-html-output-to-string (*standard-output* nil :prologue t) ,@body)) with SBCL which is multithreaded. What happens when multiple users connect to the server and the requests are served using the macro above. I mean how do multiple threads share the *standard-output* in this case? Or should I create a new stream per request? Thank you, Andrew

On Sat, Nov 24, 2007 at 05:14:07PM -0500, Andrei Stebakov wrote:
I wonder is it save to have a macro like this: (defmacro with-html (&body body) `(with-html-output-to-string (*standard-output* nil :prologue t) ,@body))
with SBCL which is multithreaded. What happens when multiple users connect to the server and the requests are served using the macro above. I mean how do multiple threads share the *standard-output* in this case? Or should I create a new stream per request?
Dynamic bindings of special variables are per-thread, so they will not interfere with each other. Zach

Thanks! Andrew On Nov 24, 2007 5:22 PM, Zach Beane <xach@xach.com> wrote:
On Sat, Nov 24, 2007 at 05:14:07PM -0500, Andrei Stebakov wrote:
I wonder is it save to have a macro like this: (defmacro with-html (&body body) `(with-html-output-to-string (*standard-output* nil :prologue t) ,@body))
with SBCL which is multithreaded. What happens when multiple users connect to the server and the requests are served using the macro above. I mean how do multiple threads share the *standard-output* in this case? Or should I create a new stream per request?
Dynamic bindings of special variables are per-thread, so they will not interfere with each other.
Zach _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
participants (2)
-
Andrei Stebakov
-
Zach Beane