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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43d219cd3e4430fa02572b4968e50e98566b13b0
4
- data.tar.gz: dcb8c3d6436d7656eaca9d18ddf13ca415a1f80e
3
+ metadata.gz: 5288f2fb62c9793359b7daf2aa8db1085fbfa68f
4
+ data.tar.gz: 7eb883ca3a5edc7b197e89e34e78597e1fe4fe9e
5
5
  SHA512:
6
- metadata.gz: 95eff5b255678fdb861ea0888a9aabf7be7d36fa85c84fcf6e4699a6919f8651021cd5a09e6f6a337301aa5668ed9260fb9ce9c869372df3fb513b778b7101d1
7
- data.tar.gz: ebc100b4b057f3959f7a3b270f7c4ef4a2c915c21a5a6b619e157160622c79e17c6b60945908965a46e24df2a6c66169135360b250c11ef848d1913131e81d73
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(business)
17
- @tasks << business
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
- @tasks.pop
32
+ @semaphore.synchronize {
33
+ @tasks.pop
34
+ }
32
35
  end
33
36
  end
34
- end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module TaskBag
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
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.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-09 00:00:00.000000000 Z
11
+ date: 2013-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler