Ignore:
Timestamp:
Nov 8, 2007, 9:30:14 AM (14 years ago)
Author:
gb
Message:

Make sure that CCL::PIPE and CCL::FD-OPEN try to force finalization if
they run out of FDs.

Push new entries on the finalization queue via CCL::ATOMIC-PUSH-UVECTOR-CELL.
Defer GC when deleting entries from the finalization queue in
CANCEL-TERMINATE-WHEN-UNREACHABLE.

"canonicalize" the foreign type (:ARRAY :INT 2); using it would make the
code for CCL::PIPE a little clearer, but there are bootstrapping issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0710/ccl/level-1/linux-files.lisp

    r7514 r7611  
    641641
    642642
    643 #+linux-target
    644 (defun pipe ()
    645   (%stack-block ((pipes 8))
    646     (let* ((status (syscall syscalls::pipe pipes)))
    647       (if (= 0 status)
    648         (values (%get-long pipes 0) (%get-long pipes 4))
    649         (%errno-disp status)))))
     643
    650644
    651645
    652646;;; I believe that the Darwin/FreeBSD syscall infterface is rather ... odd.
    653647;;; Use libc's interface.
    654 #+(or darwin-target freebsd-target)
    655648(defun pipe ()
     649  ;;  (rlet ((filedes (:array :int 2)))
    656650  (%stack-block ((filedes 8))
    657     (let* ((status (#_pipe filedes)))
     651    (let* ((status (#_pipe filedes))
     652           (errno (if (eql status 0) 0 (%get-errno))))
     653      (unless (zerop status)
     654        (when (or (eql errno (- #$EMFILE))
     655                  (eql errno (- #$ENFILE)))
     656          (gc)
     657          (drain-termination-queue)
     658          (setq status (#_pipe filedes)
     659                errno (if (zerop status) 0 (%get-errno)))))
    658660      (if (zerop status)
    659661        (values (paref filedes (:array :int)  0) (paref filedes (:array :int)  1))
    660         (%errno-disp (%get-errno))))))
     662        (%errno-disp errno)))))
    661663
    662664
Note: See TracChangeset for help on using the changeset viewer.