Attempt to support EINTR from select()

slava 2006-11-09 03:57:47 +00:00
parent 7ee2128ff0
commit 56b12ba4c0
2 changed files with 12 additions and 4 deletions

View 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

View 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 ;