proc-wait3 2.0.0 → 2.1.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: bba2d43b0af474f64ee8879055afc649a62afed46269bafc2bea754eb2ab770b
4
- data.tar.gz: 0b5e3a6ebc48e370c32273db28e107c068a70e08f367031011bb0c1d1c2065a8
3
+ metadata.gz: d9ed8e7bd3a3b5631bbb5e2a4d658c60d1876e8880ebc95eab77f920d81b26be
4
+ data.tar.gz: fa72e2f110aa9a1c4858d7c7a51cc072f115d7de0e63c7f7f0fca0210d26315e
5
5
  SHA512:
6
- metadata.gz: e31e23649b03fcff7e274634536c6c5924ff9e0cecb52141c34a694c71a3817a00dded441394b9dbd3f7266818c4ec2ca41a41e7b347b63cdad148ab43a7a28b
7
- data.tar.gz: 86d669dfe0d6e0dcbe3b136c4b857a52039c53f61de0b0a3cbed9f36bc274ce9c6487136c3e52f112e2f8cd2c2414acae64f239426a69e84a3d976047021e1d2
6
+ metadata.gz: 027c982ad10f5e7a66bdac1e8406df6f99f4372dd739da56b4a5c05bf9115e58bda7e6fbd5b72a3b6e3734ad652928bb3dbc4750a86a70252abc7541b0792613
7
+ data.tar.gz: 0b8289e6c28ce586d9a8f932e31b4e7dd39edfc223061a07d85ff8f8a28daf50329df4933079fcf347c592aaf9d9538ee9de78e448022222294b2a2c2ba5b91e
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.1.0 - 18-Jan-2026
2
+ * Modified the wait methods to automatically loop on EINTR for consistent
3
+ cross-platform behavior. Previously you had to do this manually on some
4
+ platforms, e.g. OSX.
5
+
1
6
  ## 2.0.0 - 10-Jan-2026
2
7
  * Added fiber scheduler support for wait3 and wait4 methods, allowing them
3
8
  to cooperate with Ruby's fiber scheduler for non-blocking async operations.
data/README.md CHANGED
@@ -70,6 +70,9 @@ BSD provides another approach using sigaction handlers + `SA_RESTART`, but it re
70
70
  the signal type in advance. So, unless you want to apply the same handler to *every* type of
71
71
  signal, I don't find it especially useful.
72
72
 
73
+ Update: As of version 2.1.0 you should no longer have to manually rescue EINTR since it's now
74
+ being handled internally.
75
+
73
76
  ## Integration with Ruby's process.c
74
77
  I considered simply providing a patch to the core process.c file, but I
75
78
  decided against it for two reasons. First, I wanted to get something
data/doc/wait3.md CHANGED
@@ -216,7 +216,7 @@ page at https://github.com/djberg96/proc-wait3.
216
216
  Apache-2.0
217
217
 
218
218
  ## Copyright
219
- (C) 2003-2024 Daniel J. Berger
219
+ (C) 2003-2026 Daniel J. Berger
220
220
 
221
221
  All Rights Reserved.
222
222
 
data/ext/proc/wait3.c CHANGED
@@ -3,6 +3,7 @@
3
3
  #include <ruby/fiber/scheduler.h>
4
4
  #include <string.h>
5
5
  #include <unistd.h>
6
+ #include <errno.h>
6
7
 
7
8
  /* Debian */
8
9
  #ifdef HAVE_SYS_RESOURCE_H
@@ -281,7 +282,14 @@ static VALUE proc_wait3(int argc, VALUE *argv, VALUE mod){
281
282
  bzero(&args, sizeof(args));
282
283
  args.flags = flags;
283
284
 
284
- rb_thread_call_without_gvl(wait3_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
285
+ /* Retry on EINTR. The RUBY_UBF_PROCESS unblocking function sends a signal
286
+ * to interrupt the blocking call. On macOS (and some other platforms),
287
+ * wait3() is not automatically restarted after being interrupted, so we
288
+ * must retry manually.
289
+ */
290
+ do {
291
+ rb_thread_call_without_gvl(wait3_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
292
+ } while(args.pid < 0 && errno == EINTR);
285
293
 
286
294
  if(args.pid < 0){
287
295
  rb_sys_fail("wait3");
@@ -383,7 +391,14 @@ static VALUE proc_wait4(int argc, VALUE *argv, VALUE mod){
383
391
  args.pid = pid;
384
392
  args.flags = flags;
385
393
 
386
- rb_thread_call_without_gvl(wait4_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
394
+ /* Retry on EINTR. The RUBY_UBF_PROCESS unblocking function sends a signal
395
+ * to interrupt the blocking call. On macOS (and some other platforms),
396
+ * wait4() is not automatically restarted after being interrupted, so we
397
+ * must retry manually.
398
+ */
399
+ do {
400
+ rb_thread_call_without_gvl(wait4_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
401
+ } while(args.result < 0 && errno == EINTR);
387
402
 
388
403
  if(args.result < 0){
389
404
  rb_sys_fail("wait4");
@@ -491,7 +506,14 @@ static VALUE proc_waitid(int argc, VALUE* argv, VALUE mod){
491
506
  args.infop.si_pid = 0;
492
507
  #endif
493
508
 
494
- rb_thread_call_without_gvl(waitid_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
509
+ /* Retry on EINTR. The RUBY_UBF_PROCESS unblocking function sends a signal
510
+ * to interrupt the blocking call. On macOS (and some other platforms),
511
+ * waitid() is not automatically restarted after being interrupted, so we
512
+ * must retry manually.
513
+ */
514
+ do {
515
+ rb_thread_call_without_gvl(waitid_without_gvl, &args, RUBY_UBF_PROCESS, NULL);
516
+ } while(args.result == -1 && errno == EINTR);
495
517
 
496
518
  if(args.result == -1)
497
519
  rb_sys_fail("waitid");
@@ -1144,8 +1166,8 @@ void Init_wait3(void)
1144
1166
  rb_define_const(rb_mProcess, "RUSAGE_THREAD", INT2FIX(RUSAGE_THREAD));
1145
1167
  #endif
1146
1168
 
1147
- /* 2.0.0: The version of the proc-wait3 library */
1148
- rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_freeze(rb_str_new2("2.0.0")));
1169
+ /* 2.1.0: The version of the proc-wait3 library */
1170
+ rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_freeze(rb_str_new2("2.1.0")));
1149
1171
 
1150
1172
  /* Define this last in our Init_wait3 function */
1151
1173
  rb_define_readonly_variable("$last_status", &v_last_status);
data/proc-wait3.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'proc-wait3'
5
- spec.version = '2.0.0'
5
+ spec.version = '2.1.0'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Apache-2.0'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -48,7 +48,7 @@ RSpec.describe Process do
48
48
  end
49
49
 
50
50
  example 'version constant is set to expected value' do
51
- expect(Process::WAIT3_VERSION).to eq('2.0.0')
51
+ expect(Process::WAIT3_VERSION).to eq('2.1.0')
52
52
  expect(Process::WAIT3_VERSION).to be_frozen
53
53
  end
54
54
 
data.tar.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- 0��=E!09��fLO rmv4
2
- {��'���)g]�+p-��&��B/pfO�����FN4l������]�ː��i||�-����N�e��.Ɏ���z�� ��VLf��
3
- �N�%�����sT��+�9:���El���.jR��W�P+���HŌɳ�y\�y�f�ا4>�C�wr�5ԭ�z�����O�L0X�Vv�Q�����㏅17|����K$�zݵ�3di���*/Q1&��"�R��#�C<Dm�!2 ʜ��6�+��h���!�MbG��� ݳ3�
4
- �?���WLRb� ⦴y<�{������P���i�JwOt����/�7?`S��)�B%$��,�P����5Q%Α-G���ޗ{�cr�
1
+ V�"Ca���M�齭�4�<�١�Q�D���J{�� ��TY�� .[0/$�:�m/�4��?M���<s`N�����:�-D��Rؽ){��jl�c&$7�d�PQݜV�G��2m���.��)R��_O�%�;b8?��*�#V
2
+ ]����}�����9��՞��%�s��B���MQ%����rj�N@�8=��p%o{<�!8�
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proc-wait3
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 4.0.3
150
+ rubygems_version: 3.6.9
151
151
  specification_version: 4
152
152
  summary: Adds wait3, wait4 and other methods to the Process module
153
153
  test_files:
metadata.gz.sig CHANGED
Binary file