diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 60f02b2ab0..0abc024d41 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -16,7 +16,6 @@ should fix in 0.82: - better i/o scheduler - yield in a loop starves i/o - "localhost" 50 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 diff --git a/library/bootstrap/primitives.factor b/library/bootstrap/primitives.factor index 6e4911ea2c..7b2757e9cb 100644 --- a/library/bootstrap/primitives.factor +++ b/library/bootstrap/primitives.factor @@ -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. diff --git a/library/threads.factor b/library/threads.factor index ce2c265129..1534c9a42e 100644 --- a/library/threads.factor +++ b/library/threads.factor @@ -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 diff --git a/library/unix/io.factor b/library/unix/io.factor index 7db98c8035..623b3e70f1 100644 --- a/library/unix/io.factor +++ b/library/unix/io.factor @@ -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 add-io-task stop ] callcc0 - ] unless 2drop ; + ] unless pending-error drop ; M: port stream-read ( count stream -- string ) dup input check-port diff --git a/library/unix/syscalls.factor b/library/unix/syscalls.factor index c859a14f1f..4a73b53929 100644 --- a/library/unix/syscalls.factor +++ b/library/unix/syscalls.factor @@ -22,14 +22,10 @@ BEGIN-STRUCT: timeval END-STRUCT : make-timeval ( ms -- timeval ) - dup -1 = [ - drop f - ] [ - 1000 /mod 1000 * - "timeval" - [ set-timeval-usec ] keep - [ set-timeval-sec ] keep - ] if ; + 1000 /mod 1000 * + "timeval" + [ set-timeval-usec ] keep + [ set-timeval-sec ] keep ; FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ;