Re: do periodic NSTask yet allow sleep?
Re: do periodic NSTask yet allow sleep?
- Subject: Re: do periodic NSTask yet allow sleep?
- From: Shawn Erickson <email@hidden>
- Date: Sun, 30 Nov 2003 10:47:44 -0800
On Nov 29, 2003, at 1:26 PM, matt neuburg 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? m.
You can get the same information programatically.
See in vm_statistics.h and mach_host.h found under /usr/include/mach.
For example from a simple tool I wrote...
int get_vm_statictics(vm_statistics_data_t *vm_stat)
{
int count = HOST_VM_INFO_COUNT;
kern_return_t result = host_statistics(mach_host_self(),
HOST_VM_INFO,
(host_info_t) vm_stat,
&count);
return (result == KERN_SUCCESS);
}
-Shawn
_______________________________________________
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.