Method: God::Driver#initialize
- Defined in:
- lib/god/driver.rb
#initialize(task) ⇒ Driver
Instantiate a new Driver and start the scheduler loop to handle events
+task+ is the Task this Driver belongs to
Returns Driver
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/god/driver.rb', line 159 def initialize(task) @task = task @events = God::DriverEventQueue.new @thread = Thread.new do loop do begin @events.pop.handle_event rescue ThreadError => e # queue is empty break rescue Exception => e = format("Unhandled exception in driver loop - (%s): %s\n%s", e.class, e., e.backtrace.join("\n")) applog(nil, :fatal, ) end end end end |