Re: ssax thread-safe? example

[email protected] Mon, 15 Dec 2003 20:37:26 -0800 (PST)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

	We have a couple of PLT Scheme experts around. Alas, they will
be away until Thursday. At present, I can venture only one guess: is
let*-values thread-safe? I know, on Bigloo, multiple-values use global
variables to pass extra values. That is perfectly OK in a
single-threaded mode: the second-class nature of multiple-values
guarantees that nothing will come between a producer and a
consumer. However, if a system decides to switch threads in-between,
the trouble is imminent.

	To verify, you may wish to globally search-and-replace
let*-values (it occurs only in SSAX.scm) with let*-values1 and values
with values1, which you can implement as

(define values1 list)

(define (call-with-values1 producer consumer)
  (apply consumer (producer)))

; Like let* but allowing for multiple-value bindings: SRFI-11
(define-syntax let*-values1
  (syntax-rules ()
    ((let*-values1 () . bodies) (begin . bodies))
    ((let*-values1 (((var) initializer) . rest) . bodies)
      (let ((var initializer))		; a single var optimization
	(let*-values1 rest . bodies)))
    ((let*-values1 ((vars initializer) . rest) . bodies)
      (call-with-values1 (lambda () initializer) ; the most generic case
	(lambda vars (let*-values1 rest . bodies))))))



	I'll ask the experts when they come back.

	Cheers,
	Oleg


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click