Skip to content

Commit

Permalink
Add timeouts to multitasking
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoeppen committed May 29, 2012
1 parent ae12fa3 commit 5f71fdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generic/multitasking.ft
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ HEX
CELL - DUP USER STATUS \ PASS or WAKE - this needs to be one cell before FOLLOWER!
CELL - DUP USER TOS \ task's top of stack when switching
CELL - DUP USER WAKE-AT \ ticks when to wake the task regardless
CELL - DUP USER WAKE-REASON \ reason for last wake
NEGATE CONSTANT USER# \ save amount of allocated user variable space

: PAUSE \ suspend task at current execution point and switch to follower
Expand Down Expand Up @@ -90,3 +89,7 @@ NEGATE CONSTANT USER# \ save amount of allocated user variable space
UP@ UART0-TASK !
['] STOP-FOR-KEY 'WAIT-KEY !
;

: TIMEOUT! TICKS @ + WAKE-AT ! ;
: TIMEOUT@ TICKS @ WAKE-AT @ - ;
: TIMEOUT? TIMEOUT@ 0> 0 WAKE-AT ! ;

0 comments on commit 5f71fdd

Please sign in to comment.