Since you're talking about "pausing" Code A, it sounds more like you need Code X to be contained in an interrupt.
What would be triggering Code X to run? That would determine the interrupt you use (timer, external, etc.).
Since you're talking about "pausing" Code A, it sounds more like you need Code X to be contained in an interrupt.
What would be triggering Code X to run? That would determine the interrupt you use (timer, external, etc.).