Changeset 13636 for trunk/source/level-1


Ignore:
Timestamp:
Apr 18, 2010, 3:47:10 AM (9 years ago)
Author:
rme
Message:

Flush ccl::*stderr* on quit. Patch from Stas Boukarev.
(see ticket:652)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-processes.lisp

    r13550 r13636  
    639639    (with-standard-abort-handling "Exit Lisp"
    640640      (prepare-to-quit)
    641       ;; We may have abruptly terminated a thread
    642       ;; which owned the output lock on *STDOUT*.
    643       ;; Don't block waiting on that lock if so.
    644       (let* ((s *stdout*)
    645              (lock (ioblock-outbuf-lock (basic-stream-ioblock s)))
    646              (locked (make-lock-acquisition)))
    647         (declare (dynamic-extent locked))
    648         (when (or (null lock) (%try-recursive-lock-object lock locked))
    649           (unwind-protect
    650                (progn
    651                  (fresh-line s)
    652                  (finish-output s)))
    653           (when (lock-acquisition.status locked) (release-lock lock)))))
     641      ;; We may have abruptly terminated a thread which owned the
     642      ;; output lock on a stream we want to flush.  Don't block
     643      ;; waiting on the lock if so.
     644      (flet ((flush-stream (s)
     645               (let* ((lock (ioblock-outbuf-lock (basic-stream-ioblock s)))
     646                      (locked (make-lock-acquisition)))
     647                 (declare (dynamic-extent locked))
     648                 (when (or (null lock)
     649                           (%try-recursive-lock-object lock locked))
     650                   (unwind-protect
     651                        (progn
     652                          (fresh-line s)
     653                          (finish-output s))
     654                     (when (lock-acquisition.status locked)
     655                       (release-lock lock)))))))
     656        (flush-stream *stdout*)
     657        (flush-stream *stderr*)))
    654658    (%set-toplevel thunk)
    655659    (toplevel)))
Note: See TracChangeset for help on using the changeset viewer.