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

Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop


  • Subject: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
  • From: email@hidden
  • Date: Wed, 30 Sep 2009 17:59:00 +0100

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


  • Follow-Ups:
    • Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
      • From: Jens Alfke <email@hidden>
    • Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
      • From: Jeff Johnson <email@hidden>
  • Prev by Date: Re: Deleting CalTasks through an Array.
  • Next by Date: [ANN] Snow Leopard Location Manager sample code update
  • Previous by thread: Re: Deleting CalTasks through an Array.
  • Next by thread: Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
  • Index(es):
    • Date
    • Thread