title: What is the correct way to prevent sleep on OS X?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5596319/how-to-programmatically-prevent-a-mac-from-going-to-sleep">How to programmatically prevent a Mac from going to sleep?</a>  </p>
  </blockquote>
  
  
  
  <p>What is the correct method on the current version of OS X (10.7) for preventing sleep while an application or process is running?</p>
  
  <p>In particular, is <code>IOCancelPowerChange</code> still (or did it ever) serve this purpose? I call <code>IOCancelPowerChange</code> in response to <code>kIOMessageCanSystemSleep</code>, but that doesn't do the trick.</p>
  
  <hr>
  
  <p>Essentially the <a href="https://stackoverflow.com/questions/5596319/how-to-programmatically-prevent-a-mac-from-going-to-sleep">same question</a> as the first part of this one has been asked before, but the <a href="http://developer.apple.com/library/mac/#qa/qa1160/_in" rel="nofollow noreferrer">documentation</a> it points to is quite old and the answer was never accepted.</p>