I would expect that your "check_for_data()" is actually performing an InputStream.read() or .read(buffer) or .read(buffer, byteOffset, byteCount), all of which are calls that block until data is available. While in a call that blocks, the thread won't load the CPU.
Trev On Wed, Feb 19, 2014 at 12:39 AM, Tobiah <[email protected]> wrote: > I'm reading data from a bluetooth barcode scanner. I > found an example and things work well. The example > though, starts a thread that pretty much just goes: > > > while(1){ > if(check_for_data()){ > handle_data(); > } > } > > So wouldn't this tank the CPU? Should I just > put a small sleep in there? Would all of that > checking the bluetooth socket also tank the battery? > Is there nothing to worry about and I should leave it > as it? > > 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] > 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 unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

