Re: NSTimer preventing sleep?
Re: NSTimer preventing sleep?
- Subject: Re: NSTimer preventing sleep?
- From: John Pannell <email@hidden>
- Date: Thu, 24 Jan 2008 20:10:25 -0700
Hi Jacob-
Consider watching for a sleep notification from the system and pausing
whatever it is you are doing until you get a wake notification.
Research NSWorkspaceWillSleepNotification for more info. Here's some
relevant code:
// register for sleep notifications
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
selector:@selector(willSleep:) name:NSWorkspaceWillSleepNotification
object:[NSWorkspace sharedWorkspace]];
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
selector:@selector(didWakeFromSleep:)
name:NSWorkspaceDidWakeNotification object:[NSWorkspace
sharedWorkspace]];
Hope this helps!
John
On Jan 24, 2008, at 12:36 PM, Jacob Bandes-Storch wrote:
I have to load images from disk each time the timer is called. I
suppose I could try to load them all into memory before starting the
timer... But that would hog resources... What other options do I have?
On Jan 24, 2008, at 10:17 AM, "Shawn Erickson" <email@hidden>
wrote:
On Jan 24, 2008 8:53 AM, Jacob Bandes-Storch <email@hidden>
wrote:
Yep, that'd be it... I'm reading from disk. There's really no way
around that in this program... is there something else I can do to
allow sleep?
Why are you reading from disk? Why do you have to poll?
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden