more efficient method to detect stop events in scheduler
Right now the scheduler has to wake up periodically (currently every 10th of a second) to call the has_to_stop() function to see if it should shut down. This condition can be set without any change to the pool, which means it bypasses the libev signalling mechanism.
There are a few minor problems with this approach:
- wakes up the thread more frequently than is strictly needed
- makes xstream_join() functions take longer to complete than necessary
- waking the scheduler up periodically may obfuscate bugs that would otherwise manifest as a scheduler hang