yield changes

cvs
Slava Pestov 2005-05-01 18:34:01 +00:00
parent c15c1e3dd8
commit b679c73096
3 changed files with 13 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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* ;