Re: Strange behaviour of *standard-output* in sbcl
- From: Richard M Kreuter <kreuter@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 13:54:58 GMT
Nikodemus Siivola <nikodemus@xxxxxxxxxxxxxxxx> writes:
On Jul 30, 5:34 pm, Joshua Taylor <joshuaaa...@xxxxxxxxx> wrote:
This suggests that WITH-OPEN-FILE could be implemented as
(defmacro with-open-file2 ((var filename &rest options) &body body)
`(with-open-stream (,var (open ,filename ,@options))
,@body))
This is not interrupt safe: if an asynch unwind occurs after open, but
before the UNWIND-PROTECT from W-O-S has been entered, the file will
be left open. (Ok, there is no guarantee that WITH-OPEN-FILE is async
signal safe -- or indeed anything, but you can always hope.)
Who says WITH-OPEN-STREAM isn't defined as if by
(defmacro with-open-stream ((var form) &body body)
`(ext:without-interrupts
(let ((,var ,form))
(unwind-protect
(ext:allow-interrupts (progn ,@body))
(close ,var)))))
? (For suitable WITHOUT-INTERRUPTS and ALLOW-INTERRUPTS, of course.)
--
RmK
.
- References:
- Strange behaviour of *standard-output* in sbcl
- From: Haiwei
- Re: Strange behaviour of *standard-output* in sbcl
- From: Pascal J. Bourguignon
- Re: Strange behaviour of *standard-output* in sbcl
- From: Haiwei
- Re: Strange behaviour of *standard-output* in sbcl
- From: Joshua Taylor
- Re: Strange behaviour of *standard-output* in sbcl
- From: Nikodemus Siivola
- Strange behaviour of *standard-output* in sbcl
- Prev by Date: Re: Lisp Machine keyboard usage
- Next by Date: Re: Turn an ordinary function into a generic function
- Previous by thread: Re: Strange behaviour of *standard-output* in sbcl
- Next by thread: Re: Strange behaviour of *standard-output* in sbcl
- Index(es):