Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
- Subject: Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop
- From: Jens Alfke <email@hidden>
- Date: Wed, 30 Sep 2009 12:57:29 -0700
On Sep 30, 2009, at 9: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.
It's usually best to close open sockets entirely before going to
sleep. The socket might not work anymore when the system wakes
(especially on a laptop). Also, it tells the peer on the other end you
won't be able to receive any data.
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.
It shouldn't take 30 seconds to send a few packets to servers. And the
user really doesn't want a forced-sleep to be delayed — it's
frustrating when you shut your MacBook because you have to take it to
a meeting, and it sits and sits and sits before the sleep indicator
starts pulsing.
—Jens_______________________________________________
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