title: Interrupt and task, timer interrupt, and tasks relationship
body: <p>I am using stm32 timer interrupt.</p>
  
  <p><strong>File 1:</strong> (interrupt function)</p>
  
  <pre><code>static int flag = 50;
  
  void timer_inter_handler(){    
      //...
      flag = some changes integer;// not 0, it is changed     
  #if 0 // **** note    
      printf("%d\r\n", flag);    
  #endif
  
  }
  
  int get_flag(){    
      return flag;    
  }
  </code></pre>
  
  <p><strong>File 2:</strong>  (other file)</p>
  
  <pre><code>int task1(){    
       static int fccount = 0;    
       while(1){    
          fccount++;
  
          if ( fccount%50000 == 0 )   
          {    
              printf("%d\r\n", get_flag());
              // ... 
          }    
       }//while(1)    
  }
  </code></pre>
  
  <p><strong>Note:</strong></p>
  
  <p>If this on, <code>task1</code> could print correct flag data changes. But if it is off, <code>task1</code> could only print default <code>50</code>value during system initialization for a couple of time. Then all the flag data printed is <code>0</code>.</p>
  
  <p>I do not know why this happen. No other place update the var flag. Any clue? </p>