[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] ssax egg
From: |
felix |
Subject: |
Re: [Chicken-users] ssax egg |
Date: |
Mon, 17 May 2004 23:05:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 |
Bruce Butterfield wrote:
After some discussion with other SSAX users a while back, a change to
the input parsing code (core.scm in the chicken port) makes it
thread-safe which is very important to my application. The default code
uses a static buffer which as you might suspect doesn't work at all well
in a multi-threaded environment. The updated code replaces
input-parse:init-buffer as follows:
(define input-parse-buffer (make-parameter #f))
(define input-parse:init-buffer
(lambda ()
(or
(input-parse-buffer)
(let ((buffer (make-string 512)))
(input-parse-buffer buffer)
buffer))))
This code is slower than the default static buffer; perhaps someone
could think of a clever runtime mechanism to use one mechanism over the
other???
Well, not really clever, but you can check the list in the variable
##sys#features
for containing #:srfi-18. If that is the case, then you are either running in
the
interpreter, or in compiled code that uses the SRFI-18 features, and as such is
likely
to use threading. But that does of course not necessarily mean SSAX has to be
reentrant. Perhaps a runtime-switch? (I would prefer the default to be
thread-safe,
though).
cheers,
felix