Ticket #652: stderr-flush-2.diff

File stderr-flush-2.diff, 1.4 KB (added by stassats, 2 years ago)
  • l1-processes.lisp

     
    641641      ;; We may have abruptly terminated a thread 
    642642      ;; which owned the output lock on *STDOUT*. 
    643643      ;; 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))))) 
     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) (%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) 
     654                       (release-lock lock))))))) 
     655        (flush-stream *stdout*) 
     656        (flush-stream *stderr*))) 
    654657    (%set-toplevel thunk) 
    655658    (toplevel))) 
    656659