io-event 1.4.0 → 1.4.2
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/event.h +0 -2
- data/ext/io/event/interrupt.h +1 -1
- data/ext/io/event/selector/array.h +1 -0
- data/ext/io/event/selector/epoll.c +1 -1
- data/ext/io/event/selector/list.h +1 -0
- data/ext/io/event/selector/pidfd.c +2 -0
- data/ext/io/event/selector/uring.c +1 -1
- 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: a0dd172aa1e65b9163bea2a39c1294f147c21eddcd22b3bd9439431329d8dd66
|
4
|
+
data.tar.gz: bdc9e0a4fc251b721f3cbdd06350f82f17b07a2e8d114ce68ec998c88e5993ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3beab3c2611dce16f10ec3045adad764b5c4ae67ac406ef9440a892d3d2eccac1cb9981d6bf5a027b19fdc665387a7b7b22b0144f595bf00beae44c9a3c83188
|
7
|
+
data.tar.gz: 33a62cc1ca97e50a6637baff60fd7a46d4003b81f66266496e3535fa4c732f07179ddbd920f7b97e25f43cc21e8394641db76d0b5ea8c16ee77c0d2619d085b5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/ext/io/event/event.h
CHANGED
data/ext/io/event/interrupt.h
CHANGED
@@ -602,7 +602,7 @@ static inline off_t io_seekable(int descriptor) {
|
|
602
602
|
return -1;
|
603
603
|
}
|
604
604
|
#else
|
605
|
-
#warning Upgrade your kernel to 5.16
|
605
|
+
#warning Upgrade your kernel to 5.16+! io_uring bugs prevent efficient io_read/io_write hooks.
|
606
606
|
static inline off_t io_seekable(int descriptor)
|
607
607
|
{
|
608
608
|
if (lseek(descriptor, 0, SEEK_CUR) == -1) {
|
@@ -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.2
|
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:
|
45
|
+
date: 2024-01-15 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.4.10
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: An event loop.
|
metadata.gz.sig
CHANGED
Binary file
|