Oooo, I just learned about semi and full coroutines in my concurrency class. That WOULD work nicely for the camera instead of the statemachine. But I imagine you'd be spending most of your time debugging your implementation rather than actually working on robotics code.
Quote:
|
Also remember that since the processor is not multithreaded, so there is no "giving up" the CPU.
|
A context switch simply involves saving all the current registers in the CPU to memory, loading all the saved registers from another thread into it, and letting it run from there. You don't need any special features in the CPU to do it. Coroutines would be implementable, since they don't really even involve concurrency. You just jump to another stack, execute for a bit, then yield back.