Some minor I/O fixes
parent
1cce70aad6
commit
e06e42bbba
|
@ -16,7 +16,6 @@ should fix in 0.82:
|
|||
- better i/o scheduler
|
||||
- yield in a loop starves i/o
|
||||
- "localhost" 50 <client> won't fail
|
||||
- issues with timeouts
|
||||
|
||||
+ ui/help:
|
||||
|
||||
|
@ -75,7 +74,6 @@ should fix in 0.82:
|
|||
|
||||
+ misc:
|
||||
|
||||
- make-image then compiler-tests sometimes reveals weird ghost words
|
||||
- 3 >n fep
|
||||
- code walker & exceptions
|
||||
- slice: if sequence or seq start is changed, abstraction violation
|
||||
|
|
|
@ -14,10 +14,11 @@ H{ } clone c-types set
|
|||
"/library/compiler/alien/primitive-types.factor" parse-resource
|
||||
|
||||
! These symbols need the same hashcode in the target as in the
|
||||
! host.
|
||||
! host. They must be symbols -- colon definitions are not
|
||||
! permitted to be carried over
|
||||
{
|
||||
vocabularies typemap builtins c-types
|
||||
cell crossref articles terms
|
||||
crossref articles terms
|
||||
}
|
||||
|
||||
! Bring up a bare cross-compiling vocabulary.
|
||||
|
|
|
@ -17,7 +17,7 @@ namespaces queues sequences vectors ;
|
|||
sleep-queue dup [ [ first ] 2apply swap - ] nsort ;
|
||||
|
||||
: sleep-time ( sorted-queue -- ms )
|
||||
dup empty? [ drop -1 ] [ peek first millis - 0 max ] if ;
|
||||
dup empty? [ drop 1000 ] [ peek first millis - 0 max ] if ;
|
||||
|
||||
DEFER: next-thread
|
||||
|
||||
|
|
|
@ -133,20 +133,23 @@ GENERIC: task-container ( task -- vector )
|
|||
] hash-each-with ;
|
||||
|
||||
: init-fdset ( fdset tasks -- )
|
||||
>r dup FD_SETSIZE clear-bits r>
|
||||
>r dup dup FD_SETSIZE clear-bits r>
|
||||
[ drop t swap rot set-bit-nth ] hash-each-with ;
|
||||
|
||||
: read-fdset/tasks
|
||||
read-fdset get-global read-tasks get-global ;
|
||||
|
||||
: write-fdset/tasks
|
||||
write-fdset get-global write-tasks get-global ;
|
||||
|
||||
: init-fdsets ( -- read write except )
|
||||
read-fdset get-global
|
||||
[ read-tasks get-global init-fdset ] keep
|
||||
write-fdset get-global
|
||||
[ write-tasks get-global init-fdset ] keep
|
||||
f ;
|
||||
read-fdset/tasks init-fdset
|
||||
write-fdset/tasks init-fdset f ;
|
||||
|
||||
: io-multiplex ( timeout -- )
|
||||
>r FD_SETSIZE init-fdsets r> make-timeval select io-error
|
||||
read-fdset get-global read-tasks get-global handle-fdset
|
||||
write-fdset get-global write-tasks get-global handle-fdset ;
|
||||
read-fdset/tasks handle-fdset
|
||||
write-fdset/tasks handle-fdset ;
|
||||
|
||||
! Readers
|
||||
|
||||
|
@ -210,7 +213,7 @@ M: read-task task-container drop read-tasks get-global ;
|
|||
: wait-to-read ( count port -- )
|
||||
2dup can-read-count? [
|
||||
[ -rot <read-task> add-io-task stop ] callcc0
|
||||
] unless 2drop ;
|
||||
] unless pending-error drop ;
|
||||
|
||||
M: port stream-read ( count stream -- string )
|
||||
dup input check-port
|
||||
|
|
|
@ -22,14 +22,10 @@ BEGIN-STRUCT: timeval
|
|||
END-STRUCT
|
||||
|
||||
: make-timeval ( ms -- timeval )
|
||||
dup -1 = [
|
||||
drop f
|
||||
] [
|
||||
1000 /mod 1000 *
|
||||
"timeval" <c-object>
|
||||
[ set-timeval-usec ] keep
|
||||
[ set-timeval-sec ] keep
|
||||
] if ;
|
||||
1000 /mod 1000 *
|
||||
"timeval" <c-object>
|
||||
[ set-timeval-usec ] keep
|
||||
[ set-timeval-sec ] keep ;
|
||||
|
||||
FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue