io-event 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ext/io/event/selector/selector.h +1 -0
- data/lib/io/event/debug/selector.rb +41 -5
- data/lib/io/event/selector.rb +1 -1
- data/lib/io/event/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48833d95b36913a471c49a15933705c021582488d4f0a83ab26b2cc08a39b092
|
4
|
+
data.tar.gz: c2ad33420135a7a72315e71362b4663503bf6bc8c6561cf4416bfc8e42f5398c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebc42847281fc77b058ab6b66c582ea7b58889eb28739c0d25f252b76c037d6341d53b06695595eae413fe67b1f9d10f564c110f01b379ccd10cc628a92e309c
|
7
|
+
data.tar.gz: a6d0dc1b314cc5c05e5284bfd5d981436ae932bc399355c4cd9d1e9f2ea033c794d4f526c23de64cfbb9f7df5f39058e2511b79fcaebaeec0365c1a5aca919f6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -9,7 +9,17 @@ module IO::Event
|
|
9
9
|
module Debug
|
10
10
|
# Enforces the selector interface and delegates operations to a wrapped selector instance.
|
11
11
|
class Selector
|
12
|
-
def
|
12
|
+
def self.wrap(selector, env = ENV)
|
13
|
+
log = nil
|
14
|
+
|
15
|
+
if log_path = env['IO_EVENT_DEBUG_SELECTOR_LOG']
|
16
|
+
log = File.open(log_path, 'w')
|
17
|
+
end
|
18
|
+
|
19
|
+
return self.new(selector, log: log)
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(selector, log: nil)
|
13
23
|
@selector = selector
|
14
24
|
|
15
25
|
@readable = {}
|
@@ -19,6 +29,20 @@ module IO::Event
|
|
19
29
|
unless Fiber.current == selector.loop
|
20
30
|
Kernel::raise "Selector must be initialized on event loop fiber!"
|
21
31
|
end
|
32
|
+
|
33
|
+
@log = log
|
34
|
+
end
|
35
|
+
|
36
|
+
def now
|
37
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
38
|
+
end
|
39
|
+
|
40
|
+
def log(message)
|
41
|
+
return unless @log
|
42
|
+
|
43
|
+
Fiber.blocking do
|
44
|
+
@log.puts("T+%10.1f; %s" % [now, message])
|
45
|
+
end
|
22
46
|
end
|
23
47
|
|
24
48
|
def wakeup
|
@@ -26,6 +50,8 @@ module IO::Event
|
|
26
50
|
end
|
27
51
|
|
28
52
|
def close
|
53
|
+
log("Closing selector")
|
54
|
+
|
29
55
|
if @selector.nil?
|
30
56
|
Kernel::raise "Selector already closed!"
|
31
57
|
end
|
@@ -36,22 +62,27 @@ module IO::Event
|
|
36
62
|
|
37
63
|
# Transfer from the calling fiber to the event loop.
|
38
64
|
def transfer
|
65
|
+
log("Transfering to event loop")
|
39
66
|
@selector.transfer
|
40
67
|
end
|
41
68
|
|
42
69
|
def resume(*arguments)
|
70
|
+
log("Resuming fiber with #{arguments.inspect}")
|
43
71
|
@selector.resume(*arguments)
|
44
72
|
end
|
45
73
|
|
46
74
|
def yield
|
75
|
+
log("Yielding to event loop")
|
47
76
|
@selector.yield
|
48
77
|
end
|
49
78
|
|
50
79
|
def push(fiber)
|
80
|
+
log("Pushing fiber #{fiber.inspect} to ready list")
|
51
81
|
@selector.push(fiber)
|
52
82
|
end
|
53
83
|
|
54
84
|
def raise(fiber, *arguments)
|
85
|
+
log("Raising exception on fiber #{fiber.inspect} with #{arguments.inspect}")
|
55
86
|
@selector.raise(fiber, *arguments)
|
56
87
|
end
|
57
88
|
|
@@ -60,19 +91,23 @@ module IO::Event
|
|
60
91
|
end
|
61
92
|
|
62
93
|
def process_wait(*arguments)
|
94
|
+
log("Waiting for process with #{arguments.inspect}")
|
63
95
|
@selector.process_wait(*arguments)
|
64
96
|
end
|
65
97
|
|
66
98
|
def io_wait(fiber, io, events)
|
99
|
+
log("Waiting for IO #{io.inspect} for events #{events.inspect}")
|
67
100
|
@selector.io_wait(fiber, io, events)
|
68
101
|
end
|
69
102
|
|
70
|
-
def io_read(
|
71
|
-
|
103
|
+
def io_read(fiber, io, buffer, length, offset = 0)
|
104
|
+
log("Reading from IO #{io.inspect} with buffer #{buffer}; length #{length} offset #{offset}")
|
105
|
+
@selector.io_read(fiber, io, buffer, length, offset)
|
72
106
|
end
|
73
107
|
|
74
|
-
def io_write(
|
75
|
-
|
108
|
+
def io_write(fiber, io, buffer, length, offset = 0)
|
109
|
+
log("Writing to IO #{io.inspect} with buffer #{buffer}; length #{length} offset #{offset}")
|
110
|
+
@selector.io_write(fiber, io, buffer, length, offset)
|
76
111
|
end
|
77
112
|
|
78
113
|
def respond_to?(name, include_private = false)
|
@@ -80,6 +115,7 @@ module IO::Event
|
|
80
115
|
end
|
81
116
|
|
82
117
|
def select(duration = nil)
|
118
|
+
log("Selecting for #{duration.inspect}")
|
83
119
|
unless Fiber.current == @selector.loop
|
84
120
|
Kernel::raise "Selector must be run on event loop fiber!"
|
85
121
|
end
|
data/lib/io/event/selector.rb
CHANGED
data/lib/io/event/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -42,7 +42,7 @@ cert_chain:
|
|
42
42
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
43
43
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
44
44
|
-----END CERTIFICATE-----
|
45
|
-
date: 2024-
|
45
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
46
46
|
dependencies: []
|
47
47
|
description:
|
48
48
|
email:
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.5.5
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: An event loop.
|
metadata.gz.sig
CHANGED
Binary file
|