• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread.sleep in loop

 
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just began using NetBeans 6.9 and it has new hints available to the programmer. One of my classes is a lowe level thread that sleep every 5 seconds after which it verifies the introduction of any USB memory devices into Windows. NetBeans hints to me that a sleep call with a while loop can be dicey, well not exactly in those words. The class functions correctly and there is no noticeable decline in performance of the program. I don't see any other way around the way I have cided the calss below:

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll have to tell us what the message is, if you want some guesses as to what it means. As far as this code goes, nothing wrong with sleeping inside a loop.
 
reply
    Bookmark Topic Watch Topic
  • New Topic