1ae1088983
Use a semaphore to signal the worker thread if there's something to do, otherwise the whole thread should just sleep and avoid to poll every N seconds.