Changeset 12225


Ignore:
Timestamp:
Jun 7, 2009, 7:50:53 PM (10 years ago)
Author:
gz
Message:

r11827 and r12111 from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-streams.lisp

    r12216 r12225  
    38433843           (synonym-method stream-input-timeout)
    38443844           (synonym-method stream-output-timeout)
    3845            (synonym-method stream-deadline))
     3845           (synonym-method stream-deadline)
     3846           (synonym-method stream-eof-transient-p))
    38463847
    38473848(defmethod (setf input-stream-timeout) (new (s synonym-stream))
     
    38823883    ((input-stream :initarg :input-stream :accessor two-way-stream-input-stream)
    38833884     (output-stream :initarg :output-stream :accessor two-way-stream-output-stream)))
     3885
     3886(defmethod stream-eof-transient-p ((stream two-way-stream))
     3887  (stream-eof-transient-p (two-way-stream-input-stream stream)))
    38843888
    38853889(defmethod print-object ((s two-way-stream) out)
     
    53795383
    53805384(defun fd-input-available-p (fd &optional milliseconds)
    5381   #+windows-target (declare (ignore fd milliseconds))
    5382   #+windows-target nil
     5385  #+windows-target
     5386  (case (%unix-fd-kind fd)
     5387    (:socket
     5388     (rlet ((infds #>fd_set)
     5389            (tv :timeval :tv_sec 0 :tv_usec 0))
     5390       (fd-zero infds)
     5391       (fd-set fd infds)
     5392       (when milliseconds
     5393         (multiple-value-bind (seconds millis)
     5394             (floor milliseconds 1000)
     5395        (setf (pref tv :timeval.tv_sec) seconds
     5396              (pref tv :timeval.tv_usec) (* 1000 millis))))
     5397       (let* ((result (#_select 1 infds (%null-ptr) (%null-ptr) (if milliseconds tv (%null-ptr)))))
     5398         (cond ((> result 0) (values t 0))
     5399               ((= result 0) (values nil 0))
     5400               (t (values nil (- (#_GetLastError))))))))
     5401    (:pipe (if (data-available-on-pipe-p fd)
     5402             (values t 0)
     5403             (if (and milliseconds (> milliseconds 0))
     5404               (values (process-wait-with-timeout "input-wait" milliseconds #'data-available-on-pipe-p fd) 0)
     5405               (values nil 0))))
     5406    ;(:character-special (windows-tty-input-available-p fd milliseconds))
     5407    (t (values nil 0)))
    53835408  #-windows-target
    53845409  (rlet ((pollfds (:array (:struct :pollfd) 1)))
     
    53915416
    53925417(defun fd-ready-for-output-p (fd &optional milliseconds)
    5393   #+windows-target (declare (ignore fd milliseconds))
    5394   #+windows-target t
     5418  #+windows-target
     5419  (case (%unix-fd-kind fd)
     5420    (:socket
     5421     (rlet ((tv :timeval :tv_sec 0 :tv_usec 0)
     5422            (outfds :fd_set))
     5423       (fd-zero outfds)
     5424       (fd-set fd outfds)
     5425       (when milliseconds
     5426         (multiple-value-bind (seconds millis)
     5427             (floor milliseconds 1000)
     5428           (setf (pref tv #>timeval.tv_sec) seconds
     5429                 (pref tv #>timeval.tv_usec) (* millis 1000))))
     5430       (let* ((res (#_select 1 (%null-ptr) outfds (%null-ptr) (if milliseconds tv (%null-ptr)))))
     5431         (cond ((> res 0) (values t 0))
     5432               ((= res 0) (values nil 0))
     5433               (t (values 0 (- (#_GetLastError))))))))
     5434    (t (values t 0)))
    53955435  #-windows-target
    53965436  (rlet ((pollfds (:array (:struct :pollfd) 1)))
Note: See TracChangeset for help on using the changeset viewer.