jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 8, 2019 22:59:00 GMT
I am new to parallel programing and would appreciate help on this simple question:
Say I have the following Sub:
void testMemory() { int sumI = 0; for (int i = 0; i <= 100; i++) { sumI = i + sumI; } SerialASC.println(sumI); sumI = 0; }
Say that testMemory() is called by loop(), loop1() and loop(2), what will happen to the value of sumI? (please disregard that SerialASC.println would need an interrupt so the value is not chopped when all cores write at the same time ...).
Does sumI needs to be declared in each core's local variables?
Thanks in advance for the community's help.
|
|
|
Post by Admin on Aug 12, 2019 10:29:15 GMT
sumI will be placed in the local RAM of the core the function is executing on therefore you need to take no special steps.
|
|
jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 12, 2019 13:56:52 GMT
sumI will be placed in the local RAM of the core the function is executing on therefore you need to take no special steps. Thank you.
|
|