Changeset 11831 for release/1.3


Ignore:
Timestamp:
Mar 20, 2009, 11:01:03 AM (10 years ago)
Author:
gb
Message:

r11827 (Windows I/O timeouts) to 1.3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/1.3/source/level-1/l1-streams.lisp

    r11627 r11831  
    53775377
    53785378(defun fd-input-available-p (fd &optional milliseconds)
    5379   #+windows-target (declare (ignore fd milliseconds))
    5380   #+windows-target nil
     5379  #+windows-target
     5380  (case (%unix-fd-kind fd)
     5381    (:socket
     5382     (rlet ((infds #>fd_set)
     5383            (tv :timeval :tv_sec 0 :tv_usec 0))
     5384       (fd-zero infds)
     5385       (fd-set fd infds)
     5386       (when milliseconds
     5387         (multiple-value-bind (seconds millis)
     5388             (floor milliseconds 1000)
     5389        (setf (pref tv :timeval.tv_sec) seconds
     5390              (pref tv :timeval.tv_usec) (* 1000 millis))))
     5391       (let* ((result (#_select 1 infds (%null-ptr) (%null-ptr) (if milliseconds tv (%null-ptr)))))
     5392         (cond ((> result 0) (values t 0))
     5393               ((= result 0) (values nil 0))
     5394               (t (values nil (- (#_GetLastError))))))))
     5395    (:pipe (if (data-available-on-pipe-p fd)
     5396             (values t 0)
     5397             (if (and milliseconds (> milliseconds 0))
     5398               (values (process-wait-with-timeout "input-wait" milliseconds #'data-available-on-pipe-p fd) 0)
     5399               (values nil 0))))
     5400    ;(:character-special (windows-tty-input-available-p fd milliseconds))
     5401    (t (values nil 0)))
    53815402  #-windows-target
    53825403  (rlet ((pollfds (:array (:struct :pollfd) 1)))
     
    53895410
    53905411(defun fd-ready-for-output-p (fd &optional milliseconds)
    5391   #+windows-target (declare (ignore fd milliseconds))
    5392   #+windows-target t
     5412  #+windows-target
     5413  (case (%unix-fd-kind fd)
     5414    (:socket
     5415     (rlet ((tv :timeval :tv_sec 0 :tv_usec 0)
     5416            (outfds :fd_set))
     5417       (fd-zero outfds)
     5418       (fd-set fd outfds)
     5419       (when milliseconds
     5420         (multiple-value-bind (seconds millis)
     5421             (floor milliseconds 1000)
     5422           (setf (pref tv #>timeval.tv_sec) seconds
     5423                 (pref tv #>timeval.tv_usec) (* millis 1000))))
     5424       (let* ((res (#_select 1 (%null-ptr) outfds (%null-ptr) (if milliseconds tv (%null-ptr)))))
     5425         (cond ((> res 0) (values t 0))
     5426               ((= res 0) (values nil 0))
     5427               (t (values 0 (- (#_GetLastError))))))))
     5428    (t (values t 0)))
    53935429  #-windows-target
    53945430  (rlet ((pollfds (:array (:struct :pollfd) 1)))
Note: See TracChangeset for help on using the changeset viewer.