io-event 1.20.0 → 1.21.0

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: 648484dee2c6698568b24073b4fcf90a32629dcfa2119c450df16cae77f52c49
4
- data.tar.gz: 895241950306f5dbc0f1c0b31f6981ec78096c6f90160c018a56dccc6102b799
3
+ metadata.gz: 10e55b8652762ef313727e0fb2c6ce68ef3c8ecfa867642b6c2098a04007210e
4
+ data.tar.gz: ee38d8bfc2cad72ca635ddddcb1e9ff647f86c1961df88239b468e6eeae03102
5
5
  SHA512:
6
- metadata.gz: ff589133ec2d19d400c0c80daf0dc1cbf448005d26ca2c2df1d893c08371387cc12d37e8d1133379b17ed599cbe947197e0765e59c9c30c603802794283d9226
7
- data.tar.gz: ec3c7a5d210053cf1e66d22eb4673c208184a044cb3b55404f34d645fcca0267711fe36ee12b7e8a7ef360d5ff6ed70a3da5ad0d64765406ec52ea2295119c40
6
+ metadata.gz: f635f52c19266b13191c5572fb34e513f6665ff049434dbc1045dcce83a96ac3edf0418f727417a4dca41fbb4d9336e5deb737a76c996de4cac939937a278b7d
7
+ data.tar.gz: ca520970a7088c0d57d3d0a531cc916c009f290d7a5784f7e8f674802a14505785cb58c06491f89bd161dec871221ca71491f6a235015f467f6be862c9e99d3e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -648,10 +648,18 @@ static
648
648
  VALUE process_wait_transfer(VALUE _arguments) {
649
649
  struct process_wait_arguments *arguments = (struct process_wait_arguments *)_arguments;
650
650
 
651
+ #ifdef IO_EVENT_SELECTOR_URING_USE_WAITID
651
652
  IO_Event_Selector_loop_yield(&arguments->selector->backend);
652
653
 
653
- #ifdef IO_EVENT_SELECTOR_URING_USE_WAITID
654
+ if (arguments->waiting->completion) {
655
+ // The kernel may still write to siginfo or reap the child. Keep the C frame alive until the original operation completes, then distinguish cancellation from process completion:
656
+ IO_Event_Selector_URing_Waiting_cancel_and_wait(arguments->selector, arguments->waiting);
657
+ }
658
+
654
659
  int32_t result = arguments->waiting->result;
660
+ if (result == -ECANCELED) {
661
+ return Qfalse;
662
+ }
655
663
 
656
664
  if (DEBUG) fprintf(stderr, "waitid result=%d pid=%d code=%d status=%d\n", result, arguments->siginfo.si_pid, arguments->siginfo.si_code, arguments->siginfo.si_status);
657
665
 
@@ -672,6 +680,8 @@ VALUE process_wait_transfer(VALUE _arguments) {
672
680
  return IO_Event_Selector_process_status_reap(arguments->siginfo.si_pid, arguments->flags);
673
681
  #endif
674
682
  #else
683
+ IO_Event_Selector_loop_yield(&arguments->selector->backend);
684
+
675
685
  if (arguments->waiting->result) {
676
686
  return IO_Event_Selector_process_status_reap(arguments->pid, arguments->flags);
677
687
  } else {
@@ -684,15 +694,17 @@ static
684
694
  VALUE process_wait_ensure(VALUE _arguments) {
685
695
  struct process_wait_arguments *arguments = (struct process_wait_arguments *)_arguments;
686
696
 
697
+ #ifdef IO_EVENT_SELECTOR_URING_USE_WAITID
698
+ // `waitid` may write to stack-backed siginfo while cancellation is pending:
699
+ IO_Event_Selector_URing_Waiting_cancel_and_wait(arguments->selector, arguments->waiting);
700
+ #else
687
701
  if (arguments->waiting->completion) {
688
702
  IO_Event_Selector_URing_Completion_cancel_async(arguments->selector, arguments->waiting->completion);
689
703
  }
690
704
 
691
- #ifndef IO_EVENT_SELECTOR_URING_USE_WAITID
692
705
  close(arguments->descriptor);
693
- #endif
694
-
695
706
  IO_Event_Selector_URing_Waiting_cancel(arguments->waiting);
707
+ #endif
696
708
 
697
709
  return Qnil;
698
710
  }
@@ -1034,7 +1046,6 @@ VALUE IO_Event_Selector_URing_io_read(VALUE self, VALUE fiber, VALUE io, VALUE b
1034
1046
  } else if (offset == size) {
1035
1047
  return rb_fiber_scheduler_io_result(0, 0);
1036
1048
  }
1037
- #endif
1038
1049
 
1039
1050
  int descriptor = IO_Event_Selector_io_descriptor(io);
1040
1051
  off_t from = io_seekable(descriptor);
@@ -1122,7 +1133,6 @@ VALUE IO_Event_Selector_URing_io_pread(VALUE self, VALUE fiber, VALUE io, VALUE
1122
1133
  } else if (offset == size) {
1123
1134
  return rb_fiber_scheduler_io_result(0, 0);
1124
1135
  }
1125
- #endif
1126
1136
  off_t from = NUM2OFFT(_from);
1127
1137
  int descriptor = IO_Event_Selector_io_descriptor(io);
1128
1138
  size_t maximum_size = size - offset;
@@ -1307,7 +1317,6 @@ VALUE IO_Event_Selector_URing_io_write(VALUE self, VALUE fiber, VALUE io, VALUE
1307
1317
  } else if (offset == size) {
1308
1318
  return rb_fiber_scheduler_io_result(0, 0);
1309
1319
  }
1310
- #endif
1311
1320
 
1312
1321
  int descriptor = IO_Event_Selector_io_descriptor(io);
1313
1322
  off_t from = io_seekable(descriptor);
@@ -1385,7 +1394,6 @@ VALUE IO_Event_Selector_URing_io_pwrite(VALUE self, VALUE fiber, VALUE io, VALUE
1385
1394
  } else if (offset == size) {
1386
1395
  return rb_fiber_scheduler_io_result(0, 0);
1387
1396
  }
1388
- #endif
1389
1397
  off_t from = NUM2OFFT(_from);
1390
1398
  int descriptor = IO_Event_Selector_io_descriptor(io);
1391
1399
  size_t maximum_size = size - offset;
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Event
10
- VERSION = "1.20.0"
10
+ VERSION = "1.21.0"
11
11
  end
12
12
  end
data.tar.gz.sig CHANGED
@@ -1,4 +1,3 @@
1
- Qde�q*�5�ա�0�
2
- �9Dh�%i&�]�._2�z;x�����mf�EC��Ya��-b��s�+�L-eI�1Mc��k�k
3
- ڲr�%�*����,C���cq���/��ׂ�%� ���HwA"?|(��jc$�Z'f �YVX����P��ps�o��gj�+�h�H��9�!��w��-��ʲ�)r
4
- #N� ���*���O�h-.�b 2�+
1
+ iO%�⣸F1,��绊vN>�7)&5i��P
2
+ ������\�!z�%�}��9��H��m��L
3
+ ! R����!,g?B<7��z�2��{F1�2��tq������eӡ��׆��3��J��NZx�2R�!?��O���q�,��+ �컑{ �X���c`�zl�Bl?˰B�{o��E���5��>I� �ް |M�P]|�AH�
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.20.0
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file