retroforth/multicore.retro
crc 7574bd59d1 retro.c: start work on the internal cleanups
FossilOrigin-Name: 62f85ac1f648c3cfdb75969af594c3a10f1dba33829dbc4ecce3a9a218f8f83a
2021-07-30 14:39:29 +00:00

29 lines
647 B
Forth

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