murasaki 0.2.1.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/murasaki/event_loop.rb +4 -1
- data/lib/murasaki/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b70d443790f1b8ff90bc9308cb7a985cdf373ca4b55c23ee5decf03b4c21fb39
|
4
|
+
data.tar.gz: bf48c8c011e137dc856f5a4d55bd19c629ce528747a35363e1f12aa0d8947e08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c04b4df7d27f6e6a89dcc6f5ad14d5802dcc706a0a3959ede59313ba8f799b97eaebb676a43027022e4dddddd464a9f43711eda69d1d7e364af69440a555ef6d
|
7
|
+
data.tar.gz: 93d33d2e2fd3afb3b47df823e842400afb84667129b86bcc24c1b23e85dc608ecfd5bb9cffda663a23e795a31e72947e35c200064a15fe2c2e52289b1f2649eb
|
data/lib/murasaki/event_loop.rb
CHANGED
@@ -15,6 +15,8 @@ module EventLoop
|
|
15
15
|
@queue = Hash.new
|
16
16
|
# Root fiber
|
17
17
|
@root_fiber = Fiber.current
|
18
|
+
# Thread for timer
|
19
|
+
@timer_thread = nil
|
18
20
|
nil
|
19
21
|
end
|
20
22
|
end
|
@@ -95,7 +97,6 @@ module EventLoop
|
|
95
97
|
@selector.select(0.2) do |monitor| # Timeout for 0.2 secs
|
96
98
|
@ios[monitor.io][:callback].call(monitor)
|
97
99
|
end
|
98
|
-
timer_once
|
99
100
|
nil
|
100
101
|
end
|
101
102
|
|
@@ -118,6 +119,7 @@ module EventLoop
|
|
118
119
|
def start
|
119
120
|
return if running?
|
120
121
|
@stop = false
|
122
|
+
@timer_thread = Thread.new { loop { sleep 0.5; timer_once }}
|
121
123
|
until @stop
|
122
124
|
run_once
|
123
125
|
end
|
@@ -128,6 +130,7 @@ module EventLoop
|
|
128
130
|
# @return [nil] nil
|
129
131
|
def stop
|
130
132
|
@stop = true
|
133
|
+
Thread.kill(@timer_thread)
|
131
134
|
nil
|
132
135
|
end
|
133
136
|
|
data/lib/murasaki/version.rb
CHANGED