Class: RestCore::ThreadPool::Task

Inherits:
Struct
  • Object
show all
Defined in:
lib/rest-core/thread_pool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jobObject

Returns the value of attribute job

Returns:

  • (Object)

    the current value of job



44
45
46
# File 'lib/rest-core/thread_pool.rb', line 44

def job
  @job
end

Instance Method Details

#callObject

this should never fail



46
47
48
49
# File 'lib/rest-core/thread_pool.rb', line 46

def call
  job.call unless cancelled
  true
end

#cancelObject

called from the other thread telling us it’s timed out



52
53
54
# File 'lib/rest-core/thread_pool.rb', line 52

def cancel
  @cancelled = true
end