title: Stopping a function currently running from an interrupt handler
body: <p>Let's say I have two functions in C, <code>a()</code> and <code>b()</code>.
  And let's say I have two interrupts corresponding to both functions. The first interrupt should start running function <code>a()</code> and stop <code>b()</code> from running if it was interrupted during its run. Similarly,  the second interrupt does the same thing for function <code>b()</code>.</p>
  
  <p>If I am currently running in <code>a()</code>, and I triggered the interrupt for <code>b()</code>. How can I start <code>b()</code> and prevent <code>a()</code> from completing after the interrupt handler finished?</p>
  
  <p>The Code is as follows:</p>
  
  <pre><code>int main(void)
  {
      Init();
      while (true)
      {
      if (run_A)
      {
        a();
        run_A = false;
      }
      if (run_B)
      {
        b();
        run_B = false;
      }   
  }
  
  void Handler(void)
  {
      IntClear(interruptMask);
  
      if (INTERRUPT_FOR_A)
      {
          run_A = true;
      }
  
      if (INTERRUPT_FOR_B)
      {
          run_B = true;
      }
  }
  </code></pre>