         # File lib/pr_eventmachine.rb, line 302
    302:   def run
    303:     raise Error.new( "already running" ) if @running
    304:     @running = true
    305:
    306:     begin
    307:       open_loopbreaker
    308:
    309:       loop {
    310:         @current_loop_time = Time.now
    311:
    312:         break if @stop_scheduled
    313:         run_timers
    314:         break if @stop_scheduled
    315:         crank_selectables
    316:         break if @stop_scheduled
    317:         run_heartbeats
    318:       }
    319:     ensure
    320:       close_loopbreaker
    321:       @selectables.each {|k, io| io.close}
    322:       @selectables.clear
    323:
    324:       @running = false
    325:     end
    326:
    327:   end