Don't spin. Use sleep() or, better yet, wait()/notify(), so you can
implement clean immediate exit when needed (such as when the service or
activity is destroyed).

--
Kostya Vasilyev -- http://kmansoft.wordpress.com
14.01.2011 2:38 пользователь "Tobiah" <[email protected]> написал:
> I need to launch a thread that will periodically look at the
> database to see whether records need to be synced to a remote server;
> I need the requests to the server to happen in the backgound.
> If this thread just spins away without being checked, won't the
> cpu be tanked? Should I put some sort of 'sleep' in the thread
> so that it only runs every so often?
>
> Thanks,
>
> Tobiah
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to