• 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: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop


  • Subject: Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
  • From: Jeff Johnson <email@hidden>
  • Date: Wed, 30 Sep 2009 12:18:44 -0500

If by 'finagle' you mean 'run', then yes, that should work. ;-)

There's a little bit more detail here:

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

-Jeff


On Sep 30, 2009, at 11:59 AM, email@hidden wrote:

Before entering sleep I would like to send small amounts of data via async instances of CFSocket to the local and some remote hosts.

So I register for the sleep notification:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
selector: @selector(appWillSleep:) name: NSWorkspaceWillSleepNotification object: NULL];


And tell all my local and remote things to stop:

- (void) appWillSleep:(NSNotification*) note
{
	[[thingHandler sharedInstance] stopAllRunningThings:self];
}

Now I presume that the 30 second sleep delay referred to in the docs for NSWorkspaceWillSleepNotification means that my app can dawdle in -appWillSleep for 30 seconds.
Is this correct?
If so then it seems likely that when this method returns the machine may sleep before all the network data requests complete.


Is it possible to finagle the runloop within -appWillSleep to allow my runloop attached CFSockets to persist for up to 30s before sleep overpowers me?
Or have I got this all wrong?


Thanks

Jonathan Mitchell

Developer
http://www.mugginsoft.com


_______________________________________________

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


References: 
 >Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop (From: email@hidden)

  • Prev by Date: Re: Does Core Data have reserved Entity names?
  • Next by Date: [MEET] October CocoaHeads Mac Developer Meetings
  • Previous by thread: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
  • Next by thread: Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
  • Index(es):
    • Date
    • Thread