taskbag 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/taskbag/bag.rb +7 -4
- data/lib/taskbag/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5288f2fb62c9793359b7daf2aa8db1085fbfa68f
|
4
|
+
data.tar.gz: 7eb883ca3a5edc7b197e89e34e78597e1fe4fe9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0d048df7e90769cb0236e2ec4e7a81a7788c200c12a3fce87a27aca7c779066357873f7b3663623a931b0af8682bac2bed66c8d4177e30f5b47d1278a3d3ea0
|
7
|
+
data.tar.gz: bfac05de3e33f37cb965f27a4f59418a1bf1eaed3edda3996c0f5e96f9182c5a916a52d8b4271b0e6c60f0cb0470ae5424fb70439a48cdc6e5ef237b1a97876f
|
data/lib/taskbag/bag.rb
CHANGED
@@ -3,6 +3,7 @@ module TaskBag
|
|
3
3
|
def initialize(task_class)
|
4
4
|
@tasks = []
|
5
5
|
@task_class = task_class
|
6
|
+
@semaphore = Mutex.new
|
6
7
|
end
|
7
8
|
|
8
9
|
def open(nthreads)
|
@@ -13,8 +14,8 @@ module TaskBag
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
def add(
|
17
|
-
@tasks <<
|
17
|
+
def add(object)
|
18
|
+
@tasks << object
|
18
19
|
end
|
19
20
|
|
20
21
|
def close
|
@@ -28,7 +29,9 @@ module TaskBag
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def next
|
31
|
-
@
|
32
|
+
@semaphore.synchronize {
|
33
|
+
@tasks.pop
|
34
|
+
}
|
32
35
|
end
|
33
36
|
end
|
34
|
-
end
|
37
|
+
end
|
data/lib/taskbag/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskbag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Palhares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|