retroforth/multicore.retro

30 lines
647 B
Forth
Raw Normal View History

Testing for multiple core support.
~~~
:core #8000 io:scan-for io:invoke ;
:core:init (n-) #0 core ;
:core:start (an-) #1 core ;
:core:pause (n-) #2 core ;
:core:pause-current #3 core ;
:core:resume (n-) #4 core ;
:core:rr (n-v) #5 core ;
:core:wr (vn-) #6 core ;
~~~
~~~
'Done var
:a [ @Done #100000 gt? [ core:pause-current ] if &Done v:inc $a c:put ] forever ;
:b [ $b c:put ] forever ;
:c [ $c c:put ] forever ;
:d [ @Done #50000 gt? [ core:pause-current ] if $d c:put ] forever ;
#1 core:init &a #1 core:start
#2 core:init &b #2 core:start
#3 core:init &c #3 core:start
#4 core:init &d #4 core:start
core:pause-current
~~~