too bad. Once again a fix for the fix. This time I overlooked a now superflous assignment.
Am Sonntag, den 17.08.2008, 15:39 +0200 schrieb Jörg F. Wittenberger: > Hi all, > > this one bit me today. > > Find attached a patch to make call-with-input-file and > call-with-output-file thread safe. > > /Jörg
Index: library.scm =================================================================== --- library.scm (Revision 11663) +++ library.scm (Arbeitskopie) @@ -1944,12 +1944,11 @@ (lambda (str thunk . mode) (let ((old ##sys#standard-input) (file (apply open-input-file str mode)) ) - (set! ##sys#standard-input file) - (##sys#call-with-values thunk - (lambda results - (close-input-port file) - (set! ##sys#standard-input old) - (apply ##sys#values results) ) ) ) ) ) ) + (fluid-let ([##sys#standard-input file]) + (##sys#call-with-values thunk + (lambda results + (close-input-port file) + (apply ##sys#values results) ) )) ) ) ) ) (define with-output-to-file (let ((open-output-file open-output-file) @@ -1957,12 +1956,11 @@ (lambda (str thunk . mode) (let ((old ##sys#standard-output) (file (apply open-output-file str mode)) ) - (set! ##sys#standard-output file) - (##sys#call-with-values thunk - (lambda results - (close-output-port file) - (set! ##sys#standard-output old) - (apply ##sys#values results) ) ) ) ) ) ) + (fluid-let ([##sys#standard-output file]) + (##sys#call-with-values thunk + (lambda results + (close-output-port file) + (apply ##sys#values results) ) )) ) ) ) ) (define (file-exists? name) (##sys#check-string name 'file-exists?)
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users