title: Is it a good embedded programming practice to disable an interrupt in an interrupt?
body: <p>I want to implement something in an ARM Cortex-M3 processor (with NVIC). I have limited knowledge about embedded systems, but I know, that an ISR routine should be as simple as possible.</p>
  
  <p>Now I have the following problem: I have an interrupt routine which invokes when a CAN message is received. In one case I have to calculate some time-consuming task with the CAN message which task cannot be interrupted by another CAN message, but other interrupts can be served during this operation. My idea is the following:</p>
  
  <ol>
  <li>CAN message received, ISR started, do some simple jobs (e.g. setting flags)</li>
  <li>Disable CAN interrupts in the CAN ISR routine. Also save the CAN message into a global variable so it can be reached in the main loop.</li>
  <li>In the main loop, do the time consuming task.</li>
  <li>After this task, enable the CAN interrupt handling again.</li>
  </ol>
  
  <p>Is it a good (or not totally bad) idea or should I do this in another way?</p>