Some optimizations in scheduler
Use timeout constants instead of magic numbers in scheduler and event loop
Set default wait timeout as max() of previous values
Fixed scheduler wait loop
Do fastloop wait until task run time
Merge pull request #244 from anton-ryzhov/speedup

Speedup main threads loops