Stop a void function when another one is running

Yes if you really need a while and depending on what's going on in the function decide to exit the while or not, then a possible construct is to have the function returns if it needs to break the while or not

boolean functionDecidesItsTimeToBreak()
{
   Instruction;
   Instruction;
   if (functionNeedsToContinue) return false;
   else return true;
}

...
  // somewhere in the code
  while (true) { // never ends unless the code in the while decides to break
    if (functionDecidesItsTimeToBreak()) break;
  }

...