- better i/o scheduler
- yield in a loop starves i/o
- "localhost" 50 <client> won't fail
-- issues with timeouts
+ ui/help:
+ 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
"/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.
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
] 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
: 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
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 ) ;