io-event 1.11.0 → 1.11.2

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: e5601614e57f23e24edb8f34dfdaf5b87ca33e902312c27fa51dc9af375ab76c
4
- data.tar.gz: c791965fb7be4525b4894de46f1a14787a19ea68920d4009e89713e3aebc1001
3
+ metadata.gz: 7c23033ceb02485410fbc8d330011826e9069a2d60cd0ca3483b575efe3d8c0e
4
+ data.tar.gz: 6c6af10647b050c564682dfe3023a92c935c048ecd14472ab13732d6c33967b9
5
5
  SHA512:
6
- metadata.gz: 6f662e6208b30d95aeb68d68ea9e3459bd51b6dc920d7bfcaa4794ffa455316443d2da3c6e954805bd8daadd0339341aab09c225054d9e81903866d63b39d9f0
7
- data.tar.gz: 0016b73d68044784ec52d270725d7f4a8bde5064bfd54c5fd3d685f36771d235ae16719fa1ca0a3f9d4dd246894e84d74e8e5025605ebcfc86fb9b5d6be39696
6
+ metadata.gz: 7ded92b87ce6a9e74d87b7f6c8fc5de54ed6f913252897fe6c7d1bd478f990e5af1ffcf3003d250a2c5537e0c55926697f9d59ab09f8ba72650c3f2aa47cc1c7
7
+ data.tar.gz: 9e63f1bf68bfde30503297abd9122cddc8caa24e7480f3ba316863e3f51f2b238e966d67969b24f6ed17e645a989db2df527119b627d1db4469008a28158ba6e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -38,6 +38,10 @@ struct IO_Event_Selector_EPoll
38
38
  {
39
39
  struct IO_Event_Selector backend;
40
40
  int descriptor;
41
+
42
+ // Flag indicating whether the selector is currently blocked in a system call.
43
+ // Set to 1 when blocked in epoll_wait() without GVL, 0 otherwise.
44
+ // Used by wakeup() to determine if an interrupt signal is needed.
41
45
  int blocked;
42
46
 
43
47
  struct timespec idle_duration;
@@ -47,6 +47,10 @@ struct IO_Event_Selector_KQueue
47
47
  {
48
48
  struct IO_Event_Selector backend;
49
49
  int descriptor;
50
+
51
+ // Flag indicating whether the selector is currently blocked in a system call.
52
+ // Set to 1 when blocked in kevent() without GVL, 0 otherwise.
53
+ // Used by wakeup() to determine if an interrupt signal is needed.
50
54
  int blocked;
51
55
 
52
56
  struct timespec idle_duration;
@@ -30,6 +30,10 @@ struct IO_Event_Selector_URing
30
30
  struct IO_Event_Selector backend;
31
31
  struct io_uring ring;
32
32
  size_t pending;
33
+
34
+ // Flag indicating whether the selector is currently blocked in a system call.
35
+ // Set to 1 when blocked in io_uring_wait_cqe_timeout() without GVL, 0 otherwise.
36
+ // Used by wakeup() to determine if an interrupt signal is needed.
33
37
  int blocked;
34
38
 
35
39
  struct timespec idle_duration;
@@ -707,6 +711,20 @@ VALUE IO_Event_Selector_URing_io_read(VALUE self, VALUE fiber, VALUE io, VALUE b
707
711
  off_t from = io_seekable(descriptor);
708
712
 
709
713
  size_t maximum_size = size - offset;
714
+
715
+ // Are we performing a non-blocking read?
716
+ if (!length) {
717
+ // If the (maximum) length is zero, that indicates we just want to read whatever is available without blocking.
718
+ // If we schedule this read into the URing, it will block until data is available, rather than returning immediately.
719
+ int state = IO_Event_Selector_nonblock_set(descriptor);
720
+
721
+ int result = read(descriptor, (char*)base+offset, maximum_size);
722
+ int error = errno;
723
+
724
+ IO_Event_Selector_nonblock_restore(descriptor, state);
725
+ return rb_fiber_scheduler_io_result(result, error);
726
+ }
727
+
710
728
  while (maximum_size) {
711
729
  int result = io_read(selector, fiber, descriptor, (char*)base+offset, maximum_size, from);
712
730
 
@@ -1093,7 +1111,7 @@ unsigned select_process_completions(struct IO_Event_Selector_URing *selector) {
1093
1111
  }
1094
1112
  }
1095
1113
 
1096
- if (DEBUG && completed > 0) fprintf(stderr, "select_process_completions(completed=%d)\n", completed);
1114
+ if (DEBUG && completed > 0) fprintf(stderr, "select_process_completions: completed=%d\n", completed);
1097
1115
 
1098
1116
  return completed;
1099
1117
  }
@@ -9,7 +9,6 @@
9
9
  #include <string.h>
10
10
 
11
11
  #include <unistd.h>
12
- #include <sys/select.h>
13
12
  #include <errno.h>
14
13
  #include <time.h>
15
14
 
@@ -17,6 +17,9 @@ module IO::Event
17
17
 
18
18
  @waiting = Hash.new.compare_by_identity
19
19
 
20
+ # Flag indicating whether the selector is currently blocked in a system call.
21
+ # Set to true when blocked in ::IO.select, false otherwise.
22
+ # Used by wakeup() to determine if an interrupt signal is needed.
20
23
  @blocked = false
21
24
 
22
25
  @ready = Queue.new
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Event
10
- VERSION = "1.11.0"
10
+ VERSION = "1.11.2"
11
11
  end
12
12
  end
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.11.2
22
+
23
+ - Fix Windows build.
24
+
25
+ ### v1.11.1
26
+
27
+ - Fix `read_nonblock` when using the `URing` selector, which was not handling zero-length reads correctly. This allows reading available data without blocking.
28
+
21
29
  ### v1.11.0
22
30
 
23
31
  - [Introduce `IO::Event::WorkerPool` for off-loading blocking operations.](https://socketry.github.io/io-event/releases/index#introduce-io::event::workerpool-for-off-loading-blocking-operations.)
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v1.11.2
4
+
5
+ - Fix Windows build.
6
+
7
+ ## v1.11.1
8
+
9
+ - Fix `read_nonblock` when using the `URing` selector, which was not handling zero-length reads correctly. This allows reading available data without blocking.
10
+
3
11
  ## v1.11.0
4
12
 
5
13
  ### Introduce `IO::Event::WorkerPool` for off-loading blocking operations.
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.11.0
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file