]> gitweb.factorcode.org Git - factor.git/commitdiff
multitasker cleanups, fix bug in inspector
authorSlava Pestov <slava@factorcode.org>
Tue, 23 Aug 2005 21:08:38 +0000 (21:08 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 23 Aug 2005 21:08:38 +0000 (21:08 +0000)
library/threads.factor
library/ui/world.factor
library/unix/syscalls.factor

index f0c96a196b5fa3f2274b60781f41ed06dabb8290..a65584af930c805fe7abe12fb971b152a0fee462 100644 (file)
@@ -23,7 +23,7 @@ DEFER: next-thread
 
 : do-sleep ( -- quot )
     sleep-queue* dup sleep-time dup 0 =
-    [ drop pop ] [ io-multiplex next-thread ] ifte ;
+    [ drop pop ] [ nip io-multiplex next-thread ] ifte ;
 
 : next-thread ( -- quot )
     run-queue dup queue-empty? [ drop do-sleep ] [ deque ] ifte ;
index dbf61c7001539c58a24ed70bf3741528dca53c82..68c49436a817533de838e21b05e275ab8099d74f 100644 (file)
@@ -66,7 +66,7 @@ DEFER: handle-event
         handle-event run-world
     ] [
         drop world-step
-        world get world-running? [ yield run-world ] when
+        world get world-running? [ 10 sleep run-world ] when
     ] ifte ;
 
 : start-world ( -- )
index 4b7f75141d1d4ca8a15b01242d3c06330113509f..2b560d537621820083615a0f8d9189f093d58390 100644 (file)
@@ -22,10 +22,14 @@ BEGIN-STRUCT: timeval
 END-STRUCT
 
 : make-timeval ( ms -- timeval )
-    1000 /mod 1000 *
-    <timeval>
-    [ set-timeval-usec ] keep
-    [ set-timeval-sec ] keep ;
+    dup -1 = [
+        drop NULL
+    ] [
+        1000 /mod 1000 *
+        <timeval>
+        [ set-timeval-usec ] keep
+        [ set-timeval-sec ] keep
+    ] ifte ;
 
 FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ;