stathat 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stathat.rb +10 -4
- data/stathat.gemspec +1 -1
- data/test/test_stathat.rb +0 -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: 4f30db6432405ab6b55e2dfc910ec9118cbbc30e
|
4
|
+
data.tar.gz: 7958f0d0103b5ec08d022de500236fc95525efdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40080c4d45e90ee6858f1b9d5e2c1b07bc215009b884819281c874e32092feb03f5337379de8d69f041bab7c539b17436a7700d8df10f28b230fe8b6321cb70
|
7
|
+
data.tar.gz: 72ef316598460e8cdb2acf0f425809154d7bfe122211de190980ea1ce8d84a246ae2be64577bb17b56b90bb100c9ab38c5b2968ae63425812d5c5b37a1bcd713
|
data/lib/stathat.rb
CHANGED
@@ -35,6 +35,7 @@ module StatHat
|
|
35
35
|
|
36
36
|
def initialize
|
37
37
|
@que = Queue.new
|
38
|
+
@runlock = Mutex.new
|
38
39
|
run_pool()
|
39
40
|
end
|
40
41
|
|
@@ -74,12 +75,12 @@ module StatHat
|
|
74
75
|
|
75
76
|
private
|
76
77
|
def run_pool
|
77
|
-
@running = true
|
78
|
+
@runlock.synchronize { @running = true }
|
78
79
|
@pool = []
|
79
80
|
5.times do |i|
|
80
81
|
@pool[i] = Thread.new do
|
81
82
|
puts "thread #{i} started"
|
82
|
-
while
|
83
|
+
while true do
|
83
84
|
point = @que.pop
|
84
85
|
# XXX check for error?
|
85
86
|
begin
|
@@ -91,6 +92,9 @@ module StatHat
|
|
91
92
|
rescue
|
92
93
|
pp $!
|
93
94
|
end
|
95
|
+
@runlock.synchronize {
|
96
|
+
break unless @running
|
97
|
+
}
|
94
98
|
end
|
95
99
|
puts "reporter thread #{i} finished"
|
96
100
|
end
|
@@ -98,9 +102,11 @@ module StatHat
|
|
98
102
|
end
|
99
103
|
|
100
104
|
def stop_pool()
|
101
|
-
@
|
105
|
+
@runlock.synchronize {
|
106
|
+
@running = false
|
107
|
+
}
|
102
108
|
@pool.each do |th|
|
103
|
-
th.join
|
109
|
+
th.join if th && th.alive?
|
104
110
|
end
|
105
111
|
end
|
106
112
|
|
data/stathat.gemspec
CHANGED
data/test/test_stathat.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stathat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StatHat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easily post stats to your StatHat account using this gem. Encapsulates
|
14
14
|
full API.
|