• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Correct use of IOPMAssertionCreateWithName(...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct use of IOPMAssertionCreateWithName(...)


  • Subject: Re: Correct use of IOPMAssertionCreateWithName(...)
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 9 Mar 2010 11:50:22 +0100


Le 9 mars 2010 à 06:39, James Bucanek a écrit :

Greetings,

I'm not sure that Darwin-Dev is the right place to post this, but since this is essentially an IOKit question, it's the closest I could find to the topic.

I'm upgrading my app and would like to use IOPMAssertionCreate()/IOPMAssertionCreateWithName() to prohibit the computer from going to sleep while performing a backup. However, the documentation seems a little vague, which has left me wondering exactly how these functions should be used.

Do I:

(a) Call IOPMAssertionCreateWithName() when starting an action that should not be interrupted by sleep mode and then call IOPMAssertionRelease() when that's over.

Or (b) do I call IOPMAssertionCreateWithName() with kIOPMAssertionLevelOn when the action starts, immediately call IOPMAssertionRelease() to release the assertion_id, and then later call IOPMAssertionCreateWithName() with kIOPMAssertionLevelOff when the task is complete.

Or (c) ?

I guess my question is really "what sequence of calls establish and rescind the sleep mode prohibition?" I skimmed the IOKit documentation and didn't find anything illuminating. I couldn't find any example code that employed these calls.

TIA,

James

a)

http://developer.apple.com/mac/library/qa/qa2004/qa1340.html
Listing 2

IOPMAssertionID assertionID;
IOReturn success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep,
                                    kIOPMAssertionLevelOn, &assertionID);
if (success == kIOReturnSuccess)
{

    //Add the work you need to do without
    //  the system sleeping here.

    success = IOPMAssertionRelease(assertionID);
    //The system will be able to sleep again.
}
...

-- Jean-Daniel




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Correct use of IOPMAssertionCreateWithName(...)
      • From: James Bucanek <email@hidden>
References: 
 >Correct use of IOPMAssertionCreateWithName(...) (From: James Bucanek <email@hidden>)

  • Prev by Date: Correct use of IOPMAssertionCreateWithName(...)
  • Next by Date: Re: Correct use of IOPMAssertionCreateWithName(...)
  • Previous by thread: Correct use of IOPMAssertionCreateWithName(...)
  • Next by thread: Re: Correct use of IOPMAssertionCreateWithName(...)
  • Index(es):
    • Date
    • Thread