Changeset 6019


Ignore:
Timestamp:
Mar 9, 2007, 7:00:24 AM (13 years ago)
Author:
gb
Message:

Encapsulation for open-file-streams.

Location:
trunk/ccl/level-1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-streams.lisp

    r5708 r6019  
    54235423;;;File streams.
    54245424
     5425(let* ((open-file-streams ())
     5426       (open-file-streams-lock (make-lock)))
     5427  (defun open-file-streams ()
     5428    (with-lock-grabbed (open-file-streams-lock)
     5429      (copy-list open-file-streams)))
     5430  (defun note-open-file-stream (f)
     5431    (with-lock-grabbed (open-file-streams-lock)
     5432      (push f open-file-streams))
     5433    t)
     5434  (defun remove-open-file-stream (f)
     5435    (with-lock-grabbed (open-file-streams-lock)
     5436      (setq open-file-streams (nremove f open-file-streams)))
     5437    t)
     5438  (defun clear-open-file-streams ()
     5439    (with-lock-grabbed (open-file-streams-lock)
     5440      (setq open-file-streams nil))))
     5441           
     5442
    54255443(defun open (filename &key (direction :input)
    54265444                      (element-type 'base-char)
  • trunk/ccl/level-1/l1-sysio.lisp

    r5995 r6019  
    639639            (unix-rename (namestring actual-filename) (probe-file-x filename)))
    640640          (delete-file actual-filename)))
    641       (with-lock-grabbed (*open-file-streams-lock*)
    642         (setq *open-file-streams* (nremove s *open-file-streams*))))))
     641      (remove-open-file-stream s))))
    643642
    644643
     
    843842                  (if (eq direction :probe)
    844843                    (close fstream)
    845                     (with-lock-grabbed (*open-file-streams-lock*)
    846                       (push fstream *open-file-streams*)))
     844                    (note-open-file-stream fstream))
    847845                  fstream)))))))))
    848846
Note: See TracChangeset for help on using the changeset viewer.