]> gitweb.factorcode.org Git - factor.git/commitdiff
Some minor I/O fixes
authorslava <slava@factorcode.org>
Thu, 11 May 2006 05:46:32 +0000 (05:46 +0000)
committerslava <slava@factorcode.org>
Thu, 11 May 2006 05:46:32 +0000 (05:46 +0000)
TODO.FACTOR.txt
library/bootstrap/primitives.factor
library/threads.factor
library/unix/io.factor
library/unix/syscalls.factor

index 60f02b2ab0cd1ab105a900108b2b58885c9d68c8..0abc024d41bb7c262104080a04ec742b7dc972ce 100644 (file)
@@ -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
index 6e4911ea2c7d0e6cd3cd5a5e56713687dd2781c8..7b2757e9cbf4c4b7b7aa3a11afce6590b28a6190 100644 (file)
@@ -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.
index ce2c2651297e263e4aef2f738bef712e1edb6b4c..1534c9a42e43eb97f39ce6ac93b55832700932ee 100644 (file)
@@ -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
 
index 7db98c803590c1bf7e3e0171f496dd354a8e3d31..623b3e70f1748cd7539169bbfa354ee65308ad37 100644 (file)
@@ -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
index c859a14f1ff1f2d2f5ad9449ea3b17673d140ee2..4a73b539297b37cbb9c29b45a125345bc43aae2f 100644 (file)
@@ -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 ) ;