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