title: Disabling Timer Coalescing in OSX for a given process
body: <p>I have a background application which requires to send a keep-alive to another process every 1.5 seconds.  Everything works smoothly in OSX 10.7 and 10.8, but under OSX 10.9 many keep-alive notifications are missed, sometime up to 3. Usually everything works fine for the first 3 or 4 minutes then problems start to occur.</p>
  
  <p>After further inspection, it seems that OSX Mavericks "Timer Coalescing" feature would be responsible for making the decision of extending the requested 1.5 seconds up to 4.0 seconds.</p>
  
  <p>Is there any way to indicate in a NSThread not to coalesce? Or at the very least to indicate the maximum coalescing variations allowed?</p>
  
  <p>See code below for reference:</p>
  
  <pre><code>+(void)keepAliveThread
  {
      @autoreleasepool {
          void (^keepAlive)() = ^ (){
              // (snipped!) do something...
          };
          dispatch_queue_t mainQueue = dispatch_get_main_queue();
          while( [NSThread currentThread].isCancelled == NO )
          {
              @autoreleasepool {
                  dispatch_async(mainQueue, keepAlive);
                  [NSThread sleepForTimeInterval:1.5];
              }
          }
      }
  }
  </code></pre>