I’m planning on putting my odometry system into a separate thread. My question is about how threads interact when updating shared variables.
For example, if I set a positional variable, x
, to 0
in one thread, while the odometry thread is running at the same time, is it possible for the odometry thread to immediately overwrite x
with a different value before the first thread finishes its task?
More generally, do threads in Vex Python execute their instructions in tandem (i.e., running at the same time), or do they alternate in some way (e.g., thread 1 executes all its instructions for one cycle, then thread 2, and so on)? I’m not sure if “cycle” is the right term here, but I hope that explains what I mean.