]> gitweb.factorcode.org Git - factor.git/commitdiff
Attempt to support EINTR from select()
authorslava <slava@factorcode.org>
Thu, 9 Nov 2006 03:57:47 +0000 (03:57 +0000)
committerslava <slava@factorcode.org>
Thu, 9 Nov 2006 03:57:47 +0000 (03:57 +0000)
TODO.FACTOR.txt
library/io/unix/io.factor

index 60d9108db607e3a852a8682f54ada31c6e875a04..c2276e5daa4a9f785646bf1467163c1cbd30a287 100644 (file)
@@ -10,8 +10,6 @@
 - mov 0x0(%esi),%ecx  why?
 - mac intel: perhaps its not a good idea using ebx as allot-tmp-reg
 - RNG is broken
-- gdb triggered 'interrupted system call' error
-- fdasfsdfsa :help -- weird
 - %allot-bignum-signed-2 still has issues on ppc
 - fix %allot-bignum-signed-1/2 on x86
 
index ea2f0b23d15a0adbfa373388112510cfa24da065..7c4a728d1aa6d32742eb3277f88814bc96de8989 100644 (file)
@@ -82,9 +82,12 @@ M: port set-timeout
     [ "Error on fd " % dup port-handle # ": " % swap % ] "" make
     swap set-port-error ;
 
+: ignorable-error? ( n -- ? )
+    dup EAGAIN number= swap EINTR number= or ;
+
 : defer-error ( port -- ? )
     #! Return t if it is an unrecoverable error.
-    err_no dup EAGAIN = over EINTR = or
+    err_no dup ignorable-error?
     [ 2drop f ] [ strerror swap report-error t ] if ;
 
 ! Associates a port with a list of continuations waiting on the
@@ -145,8 +148,15 @@ GENERIC: task-container ( task -- vector )
     read-fdset/tasks init-fdset
     write-fdset/tasks init-fdset f ;
 
+: (io-multiplex) ( ms -- )
+    [ FD_SETSIZE init-fdsets ] keep make-timeval select 0 < [
+        err_no ignorable-error? [ (io-multiplex) ] [ drop ] if
+    ] [
+        drop
+    ] if ;
+
 : io-multiplex ( ms -- )
-    >r FD_SETSIZE init-fdsets r> make-timeval select io-error
+    (io-multiplex)
     read-fdset/tasks handle-fdset
     write-fdset/tasks handle-fdset ;