Class: RestCore::ThreadPool::Task
- Inherits:
-
Struct
- Object
- Struct
- RestCore::ThreadPool::Task
- Defined in:
- lib/rest-core/thread_pool.rb
Instance Attribute Summary collapse
-
#cancelled ⇒ Object
Returns the value of attribute cancelled.
-
#job ⇒ Object
Returns the value of attribute job.
-
#mutex ⇒ Object
Returns the value of attribute mutex.
-
#thread ⇒ Object
Returns the value of attribute thread.
Instance Method Summary collapse
-
#call(working_thread) ⇒ Object
this should never fail.
- #cancel ⇒ Object
Instance Attribute Details
#cancelled ⇒ Object
Returns the value of attribute cancelled
44 45 46 |
# File 'lib/rest-core/thread_pool.rb', line 44 def cancelled @cancelled end |
#job ⇒ Object
Returns the value of attribute job
44 45 46 |
# File 'lib/rest-core/thread_pool.rb', line 44 def job @job end |
#mutex ⇒ Object
Returns the value of attribute mutex
44 45 46 |
# File 'lib/rest-core/thread_pool.rb', line 44 def mutex @mutex end |
#thread ⇒ Object
Returns the value of attribute thread
44 45 46 |
# File 'lib/rest-core/thread_pool.rb', line 44 def thread @thread end |
Instance Method Details
#call(working_thread) ⇒ Object
this should never fail
46 47 48 49 50 51 52 53 |
# File 'lib/rest-core/thread_pool.rb', line 46 def call working_thread mutex.synchronize do return if cancelled self.thread = working_thread end job.call true end |
#cancel ⇒ Object
55 56 57 |
# File 'lib/rest-core/thread_pool.rb', line 55 def cancel self.cancelled = true end |