• 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: Notification for Idle Time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification for Idle Time?


  • Subject: Re: Notification for Idle Time?
  • From: Jens Miltner <email@hidden>
  • Date: Wed, 12 Dec 2007 09:16:06 +0100


On 11.12.2007, at 20:06, Gregory Weston wrote:


On Dec 11, 2007, at 1:24 PM, Christopher Hickman wrote:

On Tuesday, December 11, 2007, at 06:23AM, "Gregory Weston" <email@hidden > wrote:
Not an NSNotification.

InstallEventLoopIdleTimer

<http://developer.apple.com/documentation/Carbon/Conceptual/
Carbon_Event_Manager/Tasks/chapter_3_section_11.html>
<http://developer.apple.com/documentation/Carbon/Reference/
Carbon_Event_Manager_Ref/Reference/reference.html#//apple_ref/c/ func/
InstallEventLoopIdleTimer>

Does anybody know if it is possible to get an EventLoopRef from my NSApplication's run loop? Greg found something that does exactly what I need, but it requires that I specify the run loop "the Carbon way" as an EventLoopRef. I just don't know how to reference my application's run loop as a Carbon EventLoopRef.

GetMainEventLoop() will work as the first argument.

But I've realized that InstallEventLoopIdleTimer probably won't do what you're looking for, so please accept my apologies. IOKit looks like it. Polling does suck, but if you poll with only the frequency you need you can mitigate the horribleness somewhat. Like if you're looking for 5 minutes of idle time, you might find it acceptable to check only every 3 seconds or so - an error of 1%.

When I asked a similar question recently, someone suggested using CGEventSourceSecondsSinceLastEventType(). I don't know what this function does internally, but it's sure a lot less code than fetching stuff from IOKit. (It's available Tiger and later, according to the docs)...
And no, this doesn't solve the polling issue :(


HTH,
</jum>

_______________________________________________

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: 
 >Re: Notification for Idle Time? (From: Gregory Weston <email@hidden>)
 >Re: Notification for Idle Time? (From: Christopher Hickman <email@hidden>)
 >Re: Notification for Idle Time? (From: Gregory Weston <email@hidden>)

  • Prev by Date: Re: Key Value Observing?
  • Next by Date: Re: Problem when inheriting settings in xcconfig files
  • Previous by thread: Re: Notification for Idle Time?
  • Next by thread: Re: Notification for Idle Time?
  • Index(es):
    • Date
    • Thread