io-event 1.16.2 → 1.16.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
- checksums.yaml.gz.sig +0 -0
- data/ext/extconf.rb +1 -1
- data/lib/io/event/debug/selector.rb +2 -0
- data/lib/io/event/interrupt.rb +11 -6
- data/lib/io/event/selector/select.rb +8 -0
- data/lib/io/event/selector.rb +6 -9
- data/lib/io/event/timers.rb +1 -1
- data/lib/io/event/version.rb +1 -1
- data/readme.md +8 -8
- data/releases.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 83f9faed054855a0c3a50ab469f315c1345a8af43641ab6c5630d648763fc55d
|
|
4
|
+
data.tar.gz: 78114e047cd897ed0192c262d099a93baea21d0c30ddb70cd57e4efc73a40889
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cea5251f1c5b93b0235e2aa6aa69c65913e13de847a535eee21343060f744b2a810eb901b15b82bbb3c9979d60a620d4d89dfba349473ab6836e9c420985b9d
|
|
7
|
+
data.tar.gz: c8752f8a0bc9da0ca37ae420364a564c68ad4cb6020124f767677a854c7d81639e9e6daa46040d8fc575e02a7231ff5409d72833b8eb15ec72684b063b5d92d2
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/ext/extconf.rb
CHANGED
|
@@ -55,7 +55,7 @@ have_func("rb_io_descriptor")
|
|
|
55
55
|
have_func("&rb_process_status_wait")
|
|
56
56
|
have_func("rb_fiber_current")
|
|
57
57
|
have_func("&rb_fiber_raise")
|
|
58
|
-
have_func("epoll_pwait2") if enable_config("epoll_pwait2", true)
|
|
58
|
+
have_func("epoll_pwait2(0, 0, 0, 0, 0)", "sys/epoll.h") if enable_config("epoll_pwait2", true)
|
|
59
59
|
|
|
60
60
|
have_header("ruby/io/buffer.h")
|
|
61
61
|
|
data/lib/io/event/interrupt.rb
CHANGED
|
@@ -14,29 +14,34 @@ module IO::Event
|
|
|
14
14
|
@selector = selector
|
|
15
15
|
@input, @output = ::IO.pipe
|
|
16
16
|
|
|
17
|
+
@output.sync = true
|
|
18
|
+
|
|
17
19
|
@fiber = Fiber.new do
|
|
18
20
|
while true
|
|
19
21
|
if @selector.io_wait(@fiber, @input, IO::READABLE)
|
|
20
22
|
@input.read_nonblock(1)
|
|
21
23
|
end
|
|
22
24
|
end
|
|
25
|
+
rescue IOError
|
|
26
|
+
# This is expected on shutdown.
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
@fiber.transfer
|
|
26
30
|
end
|
|
27
31
|
|
|
28
|
-
# Send a
|
|
32
|
+
# Send a single byte interrupt.
|
|
29
33
|
def signal
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Ignore.
|
|
34
|
+
# This must not block or enter blocking operations or raise an exception.
|
|
35
|
+
# Note that `Scheduler#unblock` defers exceptions, so `IOError` will not be raised by `@output.close` until later.
|
|
36
|
+
@output.write_nonblock(".", exception: false) rescue nil
|
|
34
37
|
end
|
|
35
38
|
|
|
36
39
|
def close
|
|
40
|
+
# In principle, this should cause the fiber to exit:
|
|
37
41
|
@input.close
|
|
42
|
+
|
|
43
|
+
# This may cause `signal` to raise an exception:
|
|
38
44
|
@output.close
|
|
39
|
-
# @fiber.raise(::Interrupt)
|
|
40
45
|
end
|
|
41
46
|
end
|
|
42
47
|
|
|
@@ -52,15 +52,19 @@ module IO::Event
|
|
|
52
52
|
@waiting = nil
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# An optional reference to a fiber which can be cleared before it is resumed.
|
|
55
56
|
Optional = Struct.new(:fiber) do
|
|
57
|
+
# Transfer control to the fiber if it is still available.
|
|
56
58
|
def transfer(*arguments)
|
|
57
59
|
fiber&.transfer(*arguments)
|
|
58
60
|
end
|
|
59
61
|
|
|
62
|
+
# @returns [Boolean | Nil] Whether the referenced fiber is still alive.
|
|
60
63
|
def alive?
|
|
61
64
|
fiber&.alive?
|
|
62
65
|
end
|
|
63
66
|
|
|
67
|
+
# Clear the referenced fiber.
|
|
64
68
|
def nullify
|
|
65
69
|
self.fiber = nil
|
|
66
70
|
end
|
|
@@ -111,7 +115,9 @@ module IO::Event
|
|
|
111
115
|
!@ready.empty?
|
|
112
116
|
end
|
|
113
117
|
|
|
118
|
+
# A linked list node used to track fibers waiting for IO events.
|
|
114
119
|
Waiter = Struct.new(:fiber, :events, :tail) do
|
|
120
|
+
# @returns [Boolean | Nil] Whether the waiting fiber is still alive.
|
|
115
121
|
def alive?
|
|
116
122
|
self.fiber&.alive?
|
|
117
123
|
end
|
|
@@ -138,10 +144,12 @@ module IO::Event
|
|
|
138
144
|
tail&.dispatch(events, &reactivate)
|
|
139
145
|
end
|
|
140
146
|
|
|
147
|
+
# Clear the waiting fiber so it will not be resumed.
|
|
141
148
|
def invalidate
|
|
142
149
|
self.fiber = nil
|
|
143
150
|
end
|
|
144
151
|
|
|
152
|
+
# Iterate over each active waiting fiber and its requested events.
|
|
145
153
|
def each(&block)
|
|
146
154
|
if fiber = self.fiber
|
|
147
155
|
yield fiber, self.events
|
data/lib/io/event/selector.rb
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
4
|
# Copyright, 2021-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
|
+
require_relative "native"
|
|
6
7
|
require_relative "selector/select"
|
|
7
8
|
require_relative "debug/selector"
|
|
8
9
|
|
|
9
10
|
module IO::Event
|
|
10
11
|
# @namespace
|
|
11
12
|
module Selector
|
|
13
|
+
selectors = [:URing, :EPoll, :KQueue, :Select]
|
|
14
|
+
BEST = const_get(selectors.find{|name| const_defined?(name)})
|
|
15
|
+
private_constant :BEST
|
|
16
|
+
|
|
12
17
|
# The default selector implementation, which is chosen based on the environment and available implementations.
|
|
13
18
|
#
|
|
14
19
|
# @parameter env [Hash] The environment to read configuration from.
|
|
@@ -16,16 +21,8 @@ module IO::Event
|
|
|
16
21
|
def self.default(env = ENV)
|
|
17
22
|
if name = env["IO_EVENT_SELECTOR"]&.to_sym
|
|
18
23
|
return const_get(name)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
if self.const_defined?(:URing)
|
|
22
|
-
URing
|
|
23
|
-
elsif self.const_defined?(:EPoll)
|
|
24
|
-
EPoll
|
|
25
|
-
elsif self.const_defined?(:KQueue)
|
|
26
|
-
KQueue
|
|
27
24
|
else
|
|
28
|
-
|
|
25
|
+
BEST
|
|
29
26
|
end
|
|
30
27
|
end
|
|
31
28
|
|
data/lib/io/event/timers.rb
CHANGED
data/lib/io/event/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -18,6 +18,14 @@ Please see the [project documentation](https://socketry.github.io/io-event/) for
|
|
|
18
18
|
|
|
19
19
|
Please see the [project releases](https://socketry.github.io/io-event/releases/index) for all releases.
|
|
20
20
|
|
|
21
|
+
### v1.16.4
|
|
22
|
+
|
|
23
|
+
- Correctly implement `Interrupt#signal` so that it is robust enough to be called by `Scheduler#unblock`.
|
|
24
|
+
|
|
25
|
+
### v1.16.3
|
|
26
|
+
|
|
27
|
+
- Handle `IOError` raised while shutting down the pure Ruby interrupt pipe, so `IO::Event::Interrupt#close` does not leak expected shutdown errors from the interrupt fiber.
|
|
28
|
+
|
|
21
29
|
### v1.16.2
|
|
22
30
|
|
|
23
31
|
- Improve timer heap performance by batching scheduled timer insertion, compacting cancelled timers during flush, and avoiding unnecessary heap rebuilds for small incremental inserts.
|
|
@@ -56,14 +64,6 @@ Please see the [project releases](https://socketry.github.io/io-event/releases/i
|
|
|
56
64
|
|
|
57
65
|
- [Enhanced `IO::Event::PriorityHeap` with deletion and bulk insertion methods](https://socketry.github.io/io-event/releases/index#enhanced-io::event::priorityheap-with-deletion-and-bulk-insertion-methods)
|
|
58
66
|
|
|
59
|
-
### v1.11.2
|
|
60
|
-
|
|
61
|
-
- Fix Windows build.
|
|
62
|
-
|
|
63
|
-
### v1.11.1
|
|
64
|
-
|
|
65
|
-
- Fix `read_nonblock` when using the `URing` selector, which was not handling zero-length reads correctly. This allows reading available data without blocking.
|
|
66
|
-
|
|
67
67
|
## Contributing
|
|
68
68
|
|
|
69
69
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v1.16.4
|
|
4
|
+
|
|
5
|
+
- Correctly implement `Interrupt#signal` so that it is robust enough to be called by `Scheduler#unblock`.
|
|
6
|
+
|
|
7
|
+
## v1.16.3
|
|
8
|
+
|
|
9
|
+
- Handle `IOError` raised while shutting down the pure Ruby interrupt pipe, so `IO::Event::Interrupt#close` does not leak expected shutdown errors from the interrupt fiber.
|
|
10
|
+
|
|
3
11
|
## v1.16.2
|
|
4
12
|
|
|
5
13
|
- Improve timer heap performance by batching scheduled timer insertion, compacting cancelled timers during flush, and avoiding unnecessary heap rebuilds for small incremental inserts.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: io-event
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.16.
|
|
4
|
+
version: 1.16.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
8
|
- Math Ieu
|
|
9
9
|
- Wander Hillen
|
|
10
10
|
- Jean Boussier
|
|
11
|
+
- Tavian Barnes
|
|
11
12
|
- Benoit Daloze
|
|
12
13
|
- Bruno Sutic
|
|
13
14
|
- Shizuo Fujita
|
|
14
|
-
- Tavian Barnes
|
|
15
15
|
- Alex Matchneer
|
|
16
16
|
- Anthony Ross
|
|
17
17
|
- Delton Ding
|
metadata.gz.sig
CHANGED
|
Binary file
|