The priority makes your thread not use less CPU Time!
In most threading model this will only cause your thread to be
scheduled less likley making it effectifly use less CPU Time.
But if this thread does computing intensive tasks it will take all the
CPU power it will get and unless the thread
As long as your thread has something to do then it will do it, unless
some other thread has something to do. The only way to save on
battery power is to have all the threads waiting for external events,
which is normally the case for user interface threads. Even
background worker threads are
Matt, are you sure the perceived slowdown in UI responsiveness is due
to this low-priority thread? The slowdown might be due to action
taken by higher priority threads (like the main UI thread) in response
to your worker thread. One other thing you could try is to put lots
of Thread.yield()
This is a really great question.
Reducing the priority on a thread may not do, at all, what you
expect. I don't know exactly what it does, myself, but my interest
has been peaked, recently, to the point where I'm about to dig in and
find out. The answer is going to be in the Linux scheduler.
I
The Android scheduler also does some things on top of the plain old
Linux scheduler, FYI.
kris
On Fri, May 25, 2012 at 11:28 AM, blake blake.me...@gmail.com wrote:
This is a really great question.
Reducing the priority on a thread may not do, at all, what you
expect. I don't know exactly
If setting the thread priority does not work, then I can only think of:
- break the job into small chunks and schedule an alarm for each chunk
- and possibly schedule the jobs for what you hope the phone's owner
is asleep
- put lots of sleep(s) in your code - every other line
6 matches
Mail list logo