tasking
Opened this issue · 0 comments
andrewtholt commented
Hi
I finally found time to have a look at tasking. I've built host-serial-linux64, and added
fl ../../../src/lib/tasking.fth
to the top of app.fth for host-serial.
I have a simple test program. Two tasks, each incrementing a counter
global counter1
global counter2
: count2
begin
." Count2" cr
1 counter2 +!
pause
again
;
task: count2-task
' count2 count2-task fork
count2-task wake
background count1 begin
." Count1" cr
1 counter1 +!
pause
again
;
: .counts
." counter1 " counter1 ? cr
." counter2 " counter2 ? cr
;
: run-background ( -- ) begin pause key? until key drop ;
So using : pause .counts
I get
Count1
counter1 1
counter2 0
ok pause .counts
Count1
counter1 2
counter2 0
ok pause .counts
Count1
counter1 3
counter2 0
As you can see only one task runs.
I have a feeling that I'm missing something simple/obvious.
Any advice gratefully received.