io-event 1.1.4 → 1.1.6

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: 24132010da80dc62afdf1bc31b5e7b9c26fe6ad4f38c14b09e507f202d72afdd
4
- data.tar.gz: 551cffa8341dd52ed993b937ea6924853c32ef0a41ac9e06f7c45345cb92fae1
3
+ metadata.gz: c2b1d6d29aedc2b375fa708f5f3518fb39dae6ee0b5c675a4ff571192f3c00ef
4
+ data.tar.gz: 6e9b9589ef99c97a287d20e4f60f501d87ca163897d21bdd59eb03aa71085ffd
5
5
  SHA512:
6
- metadata.gz: 7d09aca9258a428103a2f2c3ecd28d7a64f7901a20302f26f02499d52025e875c17c134d46bc84a32228a189a7cbc520478e3f1e10c39b23317d8b1a1352ece2
7
- data.tar.gz: e7ec8eaa45eb246110de0ae32a39704d8885ad2952b30c6c392194eef45f7def5edea15194cc1831eb979c39d9b095e9184f464e0cd13cc72a8b1ac5c3fb252b
6
+ metadata.gz: 6447991710738ba24577100220b4ca322d79179d736ba3101bdd5fd2a2d8a23aa8983d527ebc13cdde5b038601c17d6a860ed21394a2f3d584ddd68772f505b6
7
+ data.tar.gz: e8a0232a3f36be1bfab1a1ca8a9e0a68e761d89d9f1576449ea23644eddc2643f89c9963186376d1211f25fb96853cadef82c673ca81af7430cdacb45d3f37ea
checksums.yaml.gz.sig CHANGED
Binary file
@@ -179,6 +179,7 @@ VALUE IO_Event_Selector_URing_ready_p(VALUE self) {
179
179
  return data->backend.ready ? Qtrue : Qfalse;
180
180
  }
181
181
 
182
+ // Flush the submission queue if pending operations are present.
182
183
  static
183
184
  int io_uring_submit_flush(struct IO_Event_Selector_URing *data) {
184
185
  if (data->pending) {
@@ -200,6 +201,7 @@ int io_uring_submit_flush(struct IO_Event_Selector_URing *data) {
200
201
  return 0;
201
202
  }
202
203
 
204
+ // Immediately flush the submission queue, yielding to the event loop if it was not successful.
203
205
  static
204
206
  int io_uring_submit_now(struct IO_Event_Selector_URing *data) {
205
207
  while (true) {
@@ -656,6 +658,9 @@ VALUE IO_Event_Selector_URing_select(VALUE self, VALUE duration) {
656
658
  struct IO_Event_Selector_URing *data = NULL;
657
659
  TypedData_Get_Struct(self, struct IO_Event_Selector_URing, &IO_Event_Selector_URing_Type, data);
658
660
 
661
+ // Flush any pending events:
662
+ io_uring_submit_flush(data);
663
+
659
664
  int ready = IO_Event_Selector_queue_flush(&data->backend);
660
665
 
661
666
  int result = select_process_completions(&data->ring);
@@ -677,9 +682,6 @@ VALUE IO_Event_Selector_URing_select(VALUE self, VALUE duration) {
677
682
  if (!data->backend.ready && !timeout_nonblocking(arguments.timeout)) {
678
683
  // This is a blocking operation, we wait for events:
679
684
  result = select_internal_without_gvl(&arguments);
680
- } else {
681
- // The timeout specified required "nonblocking" behaviour so we just flush the SQ if required:
682
- io_uring_submit_flush(data);
683
685
  }
684
686
 
685
687
  // After waiting/flushing the SQ, check if there are any completions:
@@ -29,6 +29,8 @@ module IO::Event
29
29
  def signal
30
30
  @output.write('.')
31
31
  @output.flush
32
+ rescue IOError
33
+ # Ignore.
32
34
  end
33
35
 
34
36
  def close
@@ -9,6 +9,9 @@ module IO::Event
9
9
  module Selector
10
10
  def self.nonblock(io, &block)
11
11
  io.nonblock(&block)
12
+ rescue Errno::EBADF
13
+ # Windows.
14
+ yield
12
15
  end
13
16
  end
14
17
  end
@@ -134,6 +134,12 @@ module IO::Event
134
134
  waiter&.invalidate
135
135
  end
136
136
 
137
+ def io_select(readable, writable, priority, timeout)
138
+ Thread.new do
139
+ IO.select(readable, writable, priority, timeout)
140
+ end.value
141
+ end
142
+
137
143
  EAGAIN = -Errno::EAGAIN::Errno
138
144
  EWOULDBLOCK = -Errno::EWOULDBLOCK::Errno
139
145
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  class IO
7
7
  module Event
8
- VERSION = "1.1.4"
8
+ VERSION = "1.1.6"
9
9
  end
10
10
  end
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.1.4
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -41,7 +41,7 @@ cert_chain:
41
41
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
42
42
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
43
43
  -----END CERTIFICATE-----
44
- date: 2022-12-07 00:00:00.000000000 Z
44
+ date: 2023-01-10 00:00:00.000000000 Z
45
45
  dependencies:
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bake
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.3.7
153
+ rubygems_version: 3.4.1
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: An event loop.
metadata.gz.sig CHANGED
Binary file