title: iPhone accelerometer:didAccelerate: seems to not get called while I am running a loop
body: <p>An accelerometer related question. (Sorry the formatting may not look right, its the first time I am using this site). I got the accelerometer working as expected using the standard code</p>
  
  <pre><code>UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer];
  accel.delegate = self;
  accel.updateInterval = 0.1;   //I also tried other update values
  </code></pre>
  
  <p>I use NSLog to log every time the accelerometer:didAccelerate: method in my class is called. The function gets called as expected and everything works fine till here. </p>
  
  <p>However, when I run a loop, the above method doesn't seem to get called. Something like this</p>
  
  <pre><code>float firstAccelValue = globalAccel; //this is the x-accel value (stored in a global by the above method)
  float nextAccelValue = firstAccelValue;
  
  while (nextAccelValue == firstAccelValue){
  
      //do something
      nextAccelValue = globalAccel; // note globalAccel is updated by the accelerometer method
  
  }
  </code></pre>
  
  <p>The above loop never exits, expectedly since the accelerometer:didAccelerate: method is not getting called, and hence globalAccel never changes value.</p>
  
  <p>If I use a fixed condition to break the while loop, I can see that after the loop ends, the method calls work fine again. </p>
  
  <p>Am I missing something obvious here? Or does the accelerometer method not fire when certain processing is being done? </p>
  
  <p>Any help would be greatly appreciated! Thanks!</p>