Skip navigation.
 
mlRe: NSTimer preventing sleep?
FROM : John Pannell
DATE : Fri Jan 25 04:10:25 2008

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_removed>> 
> wrote:
>

>> On Jan 24, 2008 8:53 AM, Jacob Bandes-Storch <<email_removed>> 
>> 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_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlNSTimer preventing sleep? Jacob Bandes-Storc… Jan 23, 18:19
mlRe: NSTimer preventing sleep? John Stiles Jan 23, 18:20
mlRe: NSTimer preventing sleep? Jacob Bandes-Storc… Jan 24, 17:24
mlRe: NSTimer preventing sleep? William Turner Jan 24, 17:50
mlRe: NSTimer preventing sleep? Jacob Bandes-Storc… Jan 24, 17:53
mlRe: NSTimer preventing sleep? Shawn Erickson Jan 24, 19:17
mlRe: NSTimer preventing sleep? Jacob Bandes-Storc… Jan 24, 20:36
mlRe: NSTimer preventing sleep? Hamish Allan Jan 24, 22:02
mlRe: NSTimer preventing sleep? Dave Camp Jan 25, 00:55
mlRe: NSTimer preventing sleep? John Pannell Jan 25, 04:10