I am interested in knowing what would be the best way to implement a thread based queue.
For example:
I have 10 actions which I want to execute with only 4 t
I use a gem called work_queue. Its really practic.
Example:
require 'work_queue' wq = WorkQueue.new 4, 10 (1..10).each do |number| wq.enqueue_b("Thread#{number}") do |thread_name| puts "Hello from the #{thread_name}" end end wq.join