wires 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wires/hub.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb97d55c948913573e2401e46550542dae250305
|
4
|
+
data.tar.gz: d98c4ada2a9c71859afb47be0ede706b37beafc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ece77fc145f4c03da156da35159b53f512690879074f4a291e43739d846933ad65511d2b56b89687462bafd9d7c4292ba34b33cc21acdd12d9081839a7e2bc4d
|
7
|
+
data.tar.gz: 57a1a47f9907b9e6d7ce4688ea15f2f9a863333baed10b9d686cc17bd143673a875fd3efcaf19e1e7e95a23f4919fa9df511243a9ec8b13e7c30fcc9563bf8f2
|
data/lib/wires/hub.rb
CHANGED
@@ -15,9 +15,23 @@ module Wires
|
|
15
15
|
@before_kills = Queue.new
|
16
16
|
@after_kills = Queue.new
|
17
17
|
|
18
|
+
@please_finish_all = false
|
19
|
+
@please_kill = false
|
20
|
+
|
18
21
|
# Operate on the metaclass as a type of singleton pattern
|
19
22
|
class << self
|
20
23
|
|
24
|
+
# Clone all clonable instance variables as well
|
25
|
+
def clone_deeper
|
26
|
+
result = clone
|
27
|
+
self.instance_variables.each do |sym|
|
28
|
+
begin varcopy = instance_variable_get(sym).clone
|
29
|
+
rescue TypeError; end
|
30
|
+
result.instance_variable_set(sym, varcopy)
|
31
|
+
end
|
32
|
+
result
|
33
|
+
end
|
34
|
+
|
21
35
|
def dead?; state==:dead end
|
22
36
|
def alive?; state==:alive end
|
23
37
|
|
@@ -165,7 +179,6 @@ module Wires
|
|
165
179
|
impose_state :dead
|
166
180
|
|
167
181
|
declare_state :dead do
|
168
|
-
# task { puts "I'm dead!" }
|
169
182
|
|
170
183
|
transition_to :alive do
|
171
184
|
after { start_hegemon_auto_thread }
|
@@ -173,8 +186,7 @@ module Wires
|
|
173
186
|
end
|
174
187
|
|
175
188
|
declare_state :alive do
|
176
|
-
|
177
|
-
# task { sleep 0.05 }
|
189
|
+
|
178
190
|
task do
|
179
191
|
# puts "task #{Thread.current.inspect}";
|
180
192
|
if @queue.empty? then sleep(0)
|