zmachine 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zmachine.rb +4 -0
- data/lib/zmachine/reactor.rb +24 -1
- data/zmachine.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4e45964f4ad8cc75670cc74dbac343334027e8
|
4
|
+
data.tar.gz: e3a54b002782ea788369586b73079d05fe0b2655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dd61a9c2fbe3985a37f1f655bba28f517fc624b2e1808b7e197430dd7a9b336d3363ba2bcbf899f7d1391ee052308e7af1d50d3809feaf6d1d05fb83e4f3e8e
|
7
|
+
data.tar.gz: 79dd248e44b43da0a0deeb3bc6fa95598302088aba606893356ed517dbcca8b17f5aec8d1dc5846530551126a3c0406d665954f7a446957b8fb53b35bb8e2ac5
|
data/lib/zmachine.rb
CHANGED
data/lib/zmachine/reactor.rb
CHANGED
@@ -12,6 +12,28 @@ module ZMachine
|
|
12
12
|
|
13
13
|
class Reactor
|
14
14
|
|
15
|
+
@mutex = Mutex.new
|
16
|
+
|
17
|
+
def self.register_reactor(reactor)
|
18
|
+
@mutex.synchronize do
|
19
|
+
@reactors ||= []
|
20
|
+
@reactors << reactor
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.terminate_all_reactors
|
25
|
+
@mutex.synchronize do
|
26
|
+
@reactors.each(&:stop_event_loop)
|
27
|
+
@reactors.clear
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.unregister_reactor(reactor)
|
32
|
+
@mutex.synchronize do
|
33
|
+
@reactors.delete(reactor)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
15
37
|
def initialize
|
16
38
|
@heartbeat_interval = ZMachine.heartbeat_interval || 0.5 # coarse grained by default
|
17
39
|
@next_tick_queue = ConcurrentLinkedQueue.new
|
@@ -79,7 +101,7 @@ module ZMachine
|
|
79
101
|
ZMachine.logger.debug("zmachine:reactor:#{__method__}") if ZMachine.debug
|
80
102
|
add_shutdown_hook(shutdown_hook) if shutdown_hook
|
81
103
|
begin
|
82
|
-
|
104
|
+
Reactor.register_reactor(self)
|
83
105
|
@running = true
|
84
106
|
if callback = (callback || block)
|
85
107
|
add_timer(0) { callback.call(self) }
|
@@ -98,6 +120,7 @@ module ZMachine
|
|
98
120
|
@shutdown_hooks.pop.call until @shutdown_hooks.empty?
|
99
121
|
@next_tick_queue = ConcurrentLinkedQueue.new
|
100
122
|
@running = false
|
123
|
+
Reactor.unregister_reactor(self)
|
101
124
|
ZMachine.logger.debug("zmachine:reactor:#{__method__}", stop: :zcontext) if ZMachine.debug
|
102
125
|
ZMachine.reactor = nil
|
103
126
|
end
|
data/zmachine.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "zmachine"
|
5
|
-
spec.version = "0.4.
|
5
|
+
spec.version = "0.4.3"
|
6
6
|
spec.authors = ["LiquidM, Inc."]
|
7
7
|
spec.email = ["opensource@liquidm.com"]
|
8
8
|
spec.description = %q{pure JRuby multi-threaded mostly EventMachine compatible event loop}
|
@@ -15,5 +15,5 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
-
spec.add_dependency "liquid-ext", ">= 3.3.
|
18
|
+
spec.add_dependency "liquid-ext", ">= 3.3.9"
|
19
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LiquidM, Inc.
|
@@ -16,12 +16,12 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.3.
|
19
|
+
version: 3.3.9
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 3.3.
|
24
|
+
version: 3.3.9
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
27
|
description: pure JRuby multi-threaded mostly EventMachine compatible event loop
|