Re: "Kicking" the screensaver/display timers
Re: "Kicking" the screensaver/display timers
- Subject: Re: "Kicking" the screensaver/display timers
- From: Steve Checkoway <email@hidden>
- Date: Mon, 21 Jul 2008 17:26:44 -0700
On Jul 21, 2008, at 1:47 PM, Ethan Bold wrote:
Please don't use UpdateSystemActivity(). It will work, but
IOPMAssertionCreateWithName()* is a better option.
- UpdateSystemActivity() is in the Carbon framework; using it may
cause you to unnecessarily link with this large & bulky framework,
affecting app launch times and memory usage.
Already using it so that's not a downside.
- User's cant identify which process is keeping the display awake
when you call UpdateSystemActivity. If you use
IOPMAssertionCreateWithName(), OS X can keep track of which
processes are responsible (visible by running "pmset -g").
First time I've ever heard of pmset, but interesting.
- You only have to create an assertion once to keep the display
awake; you need to call UpdateSystemActivity() once every 25-30
seconds to cause a fake keyboard press. It's cleaner code for you.
That is handy.
Until now, UpdateSystemActivity() was the only game in town, but
please don't use it anymore! We've got a better alternative.
IOPMAssertionCreateWithName() doesn't seem to exist anywhere (google
knows nothing about it). IOPMAssertionCreate() doesn't seem to exist
in pre-10.5 and since I see no need to restrict to 10.5, that doesn't
work for me.
* Prefer IOPMAssertionCreateWithName(), which lets you pass a string
describing the purpose of the assertion (for debugging & diagnostic
use for Apple & yourself) over the vanilla IOPMASsertionCreate. If
you invoke IOPMAssertionCreate from multiple points in your code;
naming the assertions differently will help identify leaks.
As I said, IOPMAssertionCreateWithName() doesn't seem to exist. Xcode
doesn't know about it, google doesn't know about it, I can't find it
on my system:
$ find /System/Library/Frameworks -name '*.h' -print0|xargs -0 grep
IOPMAssertionCreateWithName
prints nothing.
--
Steve Checkoway
_______________________________________________
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