Class: Concurrent::Runnable::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/concurrent/runnable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ Context

Returns a new instance of Context.



11
12
13
14
15
16
17
18
# File 'lib/concurrent/runnable.rb', line 11

def initialize(runner)
  @runner = runner
  @thread = Thread.new(runner) do |runner|
    Thread.abort_on_exception = false
    runner.run
  end
  @thread.join(0.1) # let the thread start
end

Instance Attribute Details

#runnerObject (readonly)

Returns the value of attribute runner.



10
11
12
# File 'lib/concurrent/runnable.rb', line 10

def runner
  @runner
end

#threadObject (readonly)

Returns the value of attribute thread.



10
11
12
# File 'lib/concurrent/runnable.rb', line 10

def thread
  @thread
end