In the main loop of a worker thread that has to poll to know if there's work to do, I let it sleep in order to not busy-wait. How do I determine a good length for sleeping? E. g. if I wake up every millisecond, it's probably useless to sleep at all. If I wake up every ten minutes, it might make the app look unresponsive (depending on what the thread is doing).
I've heard before what cadrian says below, that a human user won't notice timespans around 100 ms, but what about approaching it from the machine side? How small can the interval get before it starts to get wasteful?
I guess, it boils down to a more general (i. e. platform-independent) version of this question.
EDIT: Of course, the question should always be rephrased first as "How can I change this to the event pattern instead of polling", but let's assume for now that I can't or don't want to.