diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 76853b736e..f138c7ebb6 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -9,7 +9,6 @@ - get all-tests to run with -no-compile - if external factor is down, don't add tons of random shit to the dictionary - scalar * matrix, vector * matrix, matrix * vector need to work -- turning vectors into row and column matrices - make-matrix is slow and ugly - move 2repeat somewhere else - rotating cube demo diff --git a/library/threads.factor b/library/threads.factor index 7c2e496c13..86fb457043 100644 --- a/library/threads.factor +++ b/library/threads.factor @@ -19,13 +19,13 @@ namespaces ; deque set-run-queue ] ifte ; -: schedule-thread ( quot -- ) run-queue enque set-run-queue ; +: schedule-thread ( quot -- ) + run-queue enque set-run-queue ; : stop ( -- ) - #! If there is a quotation in the run queue, call it, - #! otherwise wait for I/O. - pending-io? [ 10 io-multiplex ] when - next-thread [ call ] [ -1 io-multiplex stop ] ifte* ; + ! This definition gets replaced by the Unix and Win32 I/O + ! code. + next-thread [ call ] [ "No more tasks" throw ] ifte* ; : yield ( -- ) #! Add the current continuation to the run queue, and yield diff --git a/library/unix/io.factor b/library/unix/io.factor index 9685cc5cbd..6d528b80e7 100644 --- a/library/unix/io.factor +++ b/library/unix/io.factor @@ -388,3 +388,11 @@ USE: stdio IN: streams : fcopy 2drop ; + +IN: threads + +: stop ( -- ) + #! If there is a quotation in the run queue, call it, + #! otherwise wait for I/O. + pending-io? [ 10 io-multiplex ] when + next-thread [ call ] [ -1 io-multiplex stop ] ifte* ;