Class: LimitedRed::ThreadPool
- Inherits:
-
Object
- Object
- LimitedRed::ThreadPool
- Defined in:
- lib/limited_red/thread_pool.rb
Class Attribute Summary collapse
-
.threads ⇒ Object
writeonly
Sets the attribute threads.
Class Method Summary collapse
Class Attribute Details
.threads=(value) ⇒ Object (writeonly)
Sets the attribute threads
15 16 17 |
# File 'lib/limited_red/thread_pool.rb', line 15 def threads=(value) @threads = value end |
Class Method Details
.wait_for_all_threads_to_finish ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/limited_red/thread_pool.rb', line 22 def wait_for_all_threads_to_finish (@threads||[]).each do |thread| begin thread.join rescue puts "[Limited Red] Error trying to post results to Limited Red: #{$!}" end end end |
.with_a_thread_run(&block) ⇒ Object
17 18 19 20 |
# File 'lib/limited_red/thread_pool.rb', line 17 def with_a_thread_run(&block) @threads ||= [] @threads << Thread.new(&block) end |