Scheduled loops using same function

Hi Guys,

I am using an Arduino due and have multiple schedules running at the same time. I am using this Library GitHub - arduino-libraries/Scheduler: Scheduler Library for Arduino.

I have a function that 3 different loops use. Two of the loops are driven by user interaction so timing is not possible. The function does reset global variables and I would have no issue with the variables being reset multiple times as it wouldn't cause any problems for me.

What I was wondering, on the very slim chance that two loops called the function at the same time, is it possible for the loops to modify the same variable at identical times?

My understanding of the scheduler would lead me to believe that the scheduler will only yield to another loop after it has completed a line of code and thus the to instructions to reset the global variable could not happen at the very same time, just extremely quickly one after the other.

Would this be a correct assumption?

Would this be a correct assumption?

Since you only have one processor, and it can only execute one machine instruction at time, yes.

PaulS:
Since you only have one processor, and it can only execute one machine instruction at time, yes.

Awesome, I was just worried about corrupting global data but I figured I couldn't run two instructions at once. Thanks Paul