Class: Ethreadpool::Worker
- Inherits:
-
Object
- Object
- Ethreadpool::Worker
- Defined in:
- lib/threadpool/worker.rb
Instance Attribute Summary collapse
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
Instance Attribute Details
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
4 5 6 |
# File 'lib/threadpool/worker.rb', line 4 def start_time @start_time end |
Instance Method Details
#cancel ⇒ Object
23 24 25 26 |
# File 'lib/threadpool/worker.rb', line 23 def cancel @thread.exit reset end |
#job=(job) ⇒ Object
10 11 12 |
# File 'lib/threadpool/worker.rb', line 10 def job=(job) @job = job end |
#jobid ⇒ Object
28 29 30 |
# File 'lib/threadpool/worker.rb', line 28 def jobid @job.jobid if @job end |
#loaded? ⇒ Boolean
6 7 8 |
# File 'lib/threadpool/worker.rb', line 6 def loaded? !@job.nil? end |
#process ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/threadpool/worker.rb', line 14 def process return if @start_time @start_time = Time.now @thread = Thread.new { @job.run reset } end |