Re: Behaving "nice"(1) in the background
Re: Behaving "nice"(1) in the background
- Subject: Re: Behaving "nice"(1) in the background
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 22 Feb 2006 14:54:55 -0800
On 2/22/06, Alexander von Below <email@hidden> wrote:
> Hello fellow Cocoa developers,
>
> our application has some relatively time consuming maintenance to do
> at times, and we want to give the user to do this "in the background".
>
> In that case, what concerns me most is that this is as unobstrusive as
> possible - the time it takes is not really important.
>
> Are there any other ideas besides calling setpriority(2)? What would
> be a good indication when the user is "idle", or can I find out when I
> should rather wait with my processing and yield time to other apps?
>
> Any other hints on keeping my own CPU usage (using NSThreads) low are
> appreciated.
You could use a low priority thread to do the work, use a low priority
task launched by your application, or break you work up into small
units that you can have your applications runloop run when idle or
when a timer fires.
In general you really shouldn't need to worry about it (not knowing
exactly what you are doing)... the operating system will schedule your
work, preempt it when needed and degrade your threads priority
relative to its utilization of CPU resources.
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden