wires 0.2.3 → 0.2.4
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 +20 -22
- 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: 40c67db203689c9ec0f32d844252da5fd125d0b6
|
4
|
+
data.tar.gz: 9d27b886a47150a99e68d1e10f7d0e9cc4550b31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3d64df40e1a6ae3e73a8534a9a2955df9462eae21ba54119ff4b9be1ba775fc1b490497b824c3030f75d32356fd05592f1cb86d4143c7a2492a672b4480d37e
|
7
|
+
data.tar.gz: b801be4fd8e4ad7d6d90a45575c5b865e052a3d11de7267db4f5c4fac3ea482b5e8e22b35e6db87bad5811eba6e3af2ff9ef564c802195a5a5e38f42648ebd74
|
data/lib/wires/hub.rb
CHANGED
@@ -6,30 +6,28 @@ module Wires
|
|
6
6
|
# An Event Hub. Event/proc associations come in, and the procs
|
7
7
|
# get called in new threads in the order received
|
8
8
|
class Hub
|
9
|
-
|
10
|
-
@queue = Queue.new
|
11
|
-
|
12
|
-
@child_threads = Array.new
|
13
|
-
@child_threads_lock = Mutex.new
|
14
|
-
|
15
|
-
@before_kills = Queue.new
|
16
|
-
@after_kills = Queue.new
|
17
|
-
|
18
|
-
@please_finish_all = false
|
19
|
-
@please_kill = false
|
20
|
-
|
21
9
|
# Operate on the metaclass as a type of singleton pattern
|
22
10
|
class << self
|
23
11
|
|
24
|
-
#
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
12
|
+
# Moved to a dedicated method for subclass' sake
|
13
|
+
def class_init
|
14
|
+
@queue = Queue.new
|
15
|
+
|
16
|
+
@child_threads = Array.new
|
17
|
+
@child_threads_lock = Mutex.new
|
18
|
+
|
19
|
+
@before_kills = Queue.new
|
20
|
+
@after_kills = Queue.new
|
21
|
+
|
22
|
+
@please_finish_all = false
|
23
|
+
@please_kill = false
|
24
|
+
|
25
|
+
state_machine_init
|
26
|
+
nil end
|
27
|
+
|
28
|
+
# Make subclasses call class_init
|
29
|
+
def inherited(subcls)
|
30
|
+
subcls.class_init
|
33
31
|
end
|
34
32
|
|
35
33
|
def dead?; state==:dead end
|
@@ -212,7 +210,7 @@ module Wires
|
|
212
210
|
|
213
211
|
end
|
214
212
|
end
|
215
|
-
state_machine_init
|
216
213
|
|
214
|
+
class_init
|
217
215
|
end
|
218
216
|
end
|