class Futuroscope::Worker
A futuroscope worker takes care of resolving a future's value. It works together with a Pool
.
Public Class Methods
Public Instance Methods
run()
click to toggle source
Runs the worker. It keeps asking the Pool
for a new job. If the pool decides there's no job use it now or in the future, it will die and the Pool
will be notified. Otherwise, it will be given a new job or blocked until there's a new future available to process.
# File lib/futuroscope/worker.rb, line 17 def run @thread = Thread.new do while(future = @pool.pop) do future.run_future end die end end
stop()
click to toggle source
Public: Stops this worker.
# File lib/futuroscope/worker.rb, line 27 def stop @thread.kill die end
Private Instance Methods
die()
click to toggle source
# File lib/futuroscope/worker.rb, line 34 def die @pool.worker_died(self) end