does such code exist??

I doubt he want's to use an interrupt. Just don't execute it if you want to "pause" it.

loop(){
  if(doIneedToExecuteA){
    runA();
  }
  executeX();
}

void runA(){
  //do a bunch of stuff
}

void executeX(){
  //do some other stuff
}