threaded_processor 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/threaded_processor.rb +23 -1
- metadata +1 -1
data/lib/threaded_processor.rb
CHANGED
@@ -1,4 +1,26 @@
|
|
1
|
-
|
1
|
+
# ThreadedProcessor : A very simple wrapper for sized queue multithreading with Ruby
|
2
|
+
#
|
3
|
+
# = Usage
|
4
|
+
#
|
5
|
+
# object_list = %w(1..100).to_a
|
6
|
+
# threads = 5
|
7
|
+
# tp = ThreadedProcessor.new(object_list,threads) do |obj|
|
8
|
+
# puts obj
|
9
|
+
# end
|
10
|
+
# tp.run!
|
11
|
+
#
|
12
|
+
# OR
|
13
|
+
#
|
14
|
+
# tp = ThreadedProcessor.new
|
15
|
+
# tp.list = [1,2,3]
|
16
|
+
# tp << 4
|
17
|
+
# tp << 5
|
18
|
+
# tp.block = Proc.new{|x| puts x}
|
19
|
+
# tp.max_threads = 5
|
20
|
+
# tp.run!
|
21
|
+
|
22
|
+
|
23
|
+
VERSION = "0.1.1"
|
2
24
|
|
3
25
|
require 'thread'
|
4
26
|
|