aboutsummaryrefslogtreecommitdiff
path: root/vendor/supply_drop/lib/supply_drop/thread_pool.rb
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/supply_drop/lib/supply_drop/thread_pool.rb')
-rw-r--r--vendor/supply_drop/lib/supply_drop/thread_pool.rb39
1 files changed, 0 insertions, 39 deletions
diff --git a/vendor/supply_drop/lib/supply_drop/thread_pool.rb b/vendor/supply_drop/lib/supply_drop/thread_pool.rb
deleted file mode 100644
index 082cf4a..0000000
--- a/vendor/supply_drop/lib/supply_drop/thread_pool.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require 'thread'
-
-module SupplyDrop
- class ThreadPool
- def initialize(size)
- @size = size
- @jobs = Queue.new
- @retvals = []
-
- @pool = Array.new(@size) do |i|
- Thread.new do
- Thread.current[:id] = i
-
- catch(:exit) do
- loop do
- job, args = @jobs.pop
- @retvals << job.call(*args)
- end
- end
- end
- end
- end
-
-
- def schedule(*args, &block)
- @jobs << [block, args]
- end
-
-
- def shutdown
- @size.times do
- schedule { throw :exit }
- end
-
- @pool.map(&:join)
- @retvals
- end
- end
-end