io-event 1.16.2 → 1.16.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cc6abcf010ce881e4623a5736241660d1ebf6a84883767d761616ddcb23bf4e
4
- data.tar.gz: 4a438756e87e8feaefaafb40014f36c2b240fbbd837d4581c657eb310cb9b95a
3
+ metadata.gz: 7823ee584acc17c23f0f464a60271449a4298733efa62623653420b9181a5201
4
+ data.tar.gz: c71e15d6f35113a68bf31442621d2a4b9f8e8ca8d9b0d27dae234c30005f4ae0
5
5
  SHA512:
6
- metadata.gz: b910e009ff697f179290d916e5914621d25a5478e0f09ac806563a0c3808b30fc28ca652042608e60625830468f37088943559c590112dfadb0d3a48d3b54688
7
- data.tar.gz: c7501e4ef87e5c9744d666e43494b60b2b3c490d9e9cb55b75a87f7de199e1421b49ba0ce5e176cbaf230d6f3b8f838a5745cff81bac6f826328e7665de7a9e9
6
+ metadata.gz: 60764fbe8a01ce3a77d8ad796473934f41a92edf30772265d4f0abbaf89bb9b1b79e1776cd9071111e0ff2590fc9402892cbaea1e22c779f9f3fdfe5ca18b9e9
7
+ data.tar.gz: 452f83f2b2a7550b6aa01f1d5094b62171e2a6179d8760651c3275397be65fb653adf12c8db1c3470d5cdcdbacf88e48dd208f01b53e2f0ed50eac91d104c06e
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
 
@@ -107,6 +107,8 @@ module IO::Event
107
107
 
108
108
  @selector.close
109
109
  @selector = nil
110
+
111
+ @log&.flush
110
112
  end
111
113
 
112
114
  # Transfer from the calling fiber to the selector.
@@ -20,6 +20,8 @@ module IO::Event
20
20
  @input.read_nonblock(1)
21
21
  end
22
22
  end
23
+ rescue IOError
24
+ # This is expected on shutdown.
23
25
  end
24
26
 
25
27
  @fiber.transfer
@@ -36,7 +38,6 @@ module IO::Event
36
38
  def close
37
39
  @input.close
38
40
  @output.close
39
- # @fiber.raise(::Interrupt)
40
41
  end
41
42
  end
42
43
 
@@ -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
@@ -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
- Select
25
+ BEST
29
26
  end
30
27
  end
31
28
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024-2025, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "priority_heap"
7
7
 
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Event
10
- VERSION = "1.16.2"
10
+ VERSION = "1.16.3"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -18,6 +18,10 @@ 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.3
22
+
23
+ - 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.
24
+
21
25
  ### v1.16.2
22
26
 
23
27
  - Improve timer heap performance by batching scheduled timer insertion, compacting cancelled timers during flush, and avoiding unnecessary heap rebuilds for small incremental inserts.
@@ -60,10 +64,6 @@ Please see the [project releases](https://socketry.github.io/io-event/releases/i
60
64
 
61
65
  - Fix Windows build.
62
66
 
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,9 @@
1
1
  # Releases
2
2
 
3
+ ## v1.16.3
4
+
5
+ - 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.
6
+
3
7
  ## v1.16.2
4
8
 
5
9
  - 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.2
4
+ version: 1.16.3
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
@@ -1 +1,2 @@
1
- �1FF��UJngd����Yӱ�q�<
1
+ m�!�͋cX�Uy*M4���_]�)��0���#Z,:��4�ugxGCY���t���|E�[�
2
+ ^�eYe*�Βٕ`���! 7���K�hX
3
+ ��)-Rٔ'��5��B�?�]m>昷2��+m��B�����O�>+��Z�m�4�_8l��6�@��.hx���A�Fcм�:/���C� ����L3G�NL�:&�t�B�۝.�r����b[�����DS� r�P��������3=��Iz��Z�� �n��}�˲�S�v��1��=s��T=�֐��^�|3% �7�}�ؿuo��<��� �%���z~��}M�������V�Jb�q�r}��u�#-lD&���]���5o{���h]�� �*�~;C�����:�+� &�Na�