Update scheduler.rb

Adding conditional to run the handle_signals block if poll_sleep_amount = 0. Extracted handle_signals operation into a method accepting a block.