Re: do periodic NSTask yet allow sleep?
Re: do periodic NSTask yet allow sleep?
- Subject: Re: do periodic NSTask yet allow sleep?
- From: Cameron Hayne <email@hidden>
- Date: Sat, 29 Nov 2003 20:53:59 -0500
On 29/11/03 4:26 PM, "matt neuburg" <email@hidden> wrote:
>
My app (MemoryStick) is a front end for vm_stat, which it calls
>
periodically by way of an NSTask. But this prevents the computer
>
from sleeping. (I think this because NSTask hits the hard disk
>
each time it calls vm_stat.) What can I do about this? Is there a
>
notification that tells me "the computer would really like to go
>
to sleep now if only you'd stop hitting the hard disk?" Even
>
better, is there some way I can incorporate vm_stat into my own
>
code or otherwise make it be that case that I don't have to hit
>
the hard disk at all once I've (somehow) "loaded" vm_stat?
As to notifications about sleep, there is extra documentation and example
code that comes with the OS X developer kit for Power Management:
http://developer.apple.com/sdk/index.html#PowerManager
But I from what you have said above, it seems that you repeatedly create and
run an NSTask that does vm_stat. Instead, I think it would be better if you
had one NSTask that never ended and have it run vm_stat with an 'interval'
argument. Your Cocoa code would then need to separate out the output from
each iteration of vm_stat. I do something like this with an NSTask that runs
a Perl script that invokes various system commands, and my Cocoa app does
not interfere with my iBook's sleep.
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.