io-wait 0.3.0 → 0.3.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 +4 -4
- data/.document +6 -0
- data/.rdoc_options +2 -0
- data/Gemfile +1 -0
- data/_doc/io.rb +3 -0
- data/ext/io/wait/depend +1 -1
- data/ext/io/wait/extconf.rb +15 -18
- data/ext/io/wait/wait.c +17 -10
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09f49ee95b2ba86480e8e9433aeb0f05890e1573b04a9967f76a705da944c11b'
|
4
|
+
data.tar.gz: 48db6154ed263ecdb3a3ace629d629c18c18637e8577cec6d784310b38e33050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72db9c0fea93027e7c8489ad5ecc7533c99f494743939ca2a1aaac3cac3847847538e07346ae53ca9026fb20aaa801ca0d35a5e8c491047f96b1e6cea0996e92
|
7
|
+
data.tar.gz: b70fc31c4c86f82e026be29904dbb819cb45deb2b6cff8d4cde4266f039c3b3b2c64e3b6c99be9df3034f1a9b8766d87078c1e2dba379aa542e914766712f564
|
data/.document
ADDED
data/.rdoc_options
ADDED
data/Gemfile
CHANGED
data/_doc/io.rb
ADDED
data/ext/io/wait/depend
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
wait.o: $(RUBY_EXTCONF_H)
|
3
3
|
wait.o: $(arch_hdrdir)/ruby/config.h
|
4
4
|
wait.o: $(hdrdir)/ruby.h
|
5
|
-
|
5
|
+
wait.o: $(hdrdir)/ruby/assert.h
|
6
6
|
wait.o: $(hdrdir)/ruby/backward.h
|
7
7
|
wait.o: $(hdrdir)/ruby/defines.h
|
8
8
|
wait.o: $(hdrdir)/ruby/encoding.h
|
data/ext/io/wait/extconf.rb
CHANGED
@@ -1,24 +1,21 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
require 'mkmf'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
target = "io/wait"
|
5
|
+
have_func("rb_io_wait", "ruby/io.h")
|
6
|
+
have_func("rb_io_descriptor", "ruby/io.h")
|
7
|
+
unless macro_defined?("DOSISH", "#include <ruby.h>")
|
8
|
+
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
|
9
|
+
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
|
10
|
+
have_macro("FIONREAD", [h, ioctl_h].compact)
|
11
|
+
end
|
12
|
+
if fionread
|
13
|
+
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
|
14
|
+
create_makefile(target)
|
15
|
+
end
|
6
16
|
else
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
|
11
|
-
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
|
12
|
-
have_macro("FIONREAD", [h, ioctl_h].compact)
|
13
|
-
end
|
14
|
-
if fionread
|
15
|
-
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
|
16
|
-
create_makefile(target)
|
17
|
-
end
|
18
|
-
else
|
19
|
-
if have_func("rb_w32_ioctlsocket", "ruby.h")
|
20
|
-
have_func("rb_w32_is_socket", "ruby.h")
|
21
|
-
create_makefile(target)
|
22
|
-
end
|
17
|
+
if have_func("rb_w32_ioctlsocket", "ruby.h")
|
18
|
+
have_func("rb_w32_is_socket", "ruby.h")
|
19
|
+
create_makefile(target)
|
23
20
|
end
|
24
21
|
end
|
data/ext/io/wait/wait.c
CHANGED
@@ -87,8 +87,15 @@ io_nread(VALUE io)
|
|
87
87
|
rb_io_check_readable(fptr);
|
88
88
|
len = rb_io_read_pending(fptr);
|
89
89
|
if (len > 0) return INT2FIX(len);
|
90
|
-
|
91
|
-
|
90
|
+
|
91
|
+
#ifdef HAVE_RB_IO_DESCRIPTOR
|
92
|
+
int fd = rb_io_descriptor(io);
|
93
|
+
#else
|
94
|
+
int fd = fptr->fd;
|
95
|
+
#endif
|
96
|
+
|
97
|
+
if (!FIONREAD_POSSIBLE_P(fd)) return INT2FIX(0);
|
98
|
+
if (ioctl(fd, FIONREAD, &n)) return INT2FIX(0);
|
92
99
|
if (n > 0) return ioctl_arg2num(n);
|
93
100
|
return INT2FIX(0);
|
94
101
|
}
|
@@ -305,7 +312,7 @@ io_event_from_value(VALUE value)
|
|
305
312
|
/*
|
306
313
|
* call-seq:
|
307
314
|
* io.wait(events, timeout) -> event mask, false or nil
|
308
|
-
* io.wait(
|
315
|
+
* io.wait(*event_symbols[, timeout]) -> self, true, or false
|
309
316
|
*
|
310
317
|
* Waits until the IO becomes ready for the specified events and returns the
|
311
318
|
* subset of events that become ready, or a falsy value when times out.
|
@@ -313,10 +320,14 @@ io_event_from_value(VALUE value)
|
|
313
320
|
* The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
|
314
321
|
* +IO::PRIORITY+.
|
315
322
|
*
|
316
|
-
* Returns
|
323
|
+
* Returns an event mask (truthy value) immediately when buffered data is
|
324
|
+
* available.
|
317
325
|
*
|
318
|
-
*
|
319
|
-
* +:read_write
|
326
|
+
* The second form: if one or more event symbols (+:read+, +:write+, or
|
327
|
+
* +:read_write+) are passed, the event mask is the bit OR of the bitmask
|
328
|
+
* corresponding to those symbols. In this form, +timeout+ is optional, the
|
329
|
+
* order of the arguments is arbitrary, and returns +io+ if any of the
|
330
|
+
* events is ready.
|
320
331
|
*
|
321
332
|
* You must require 'io/wait' to use this method.
|
322
333
|
*/
|
@@ -353,10 +364,6 @@ io_wait(int argc, VALUE *argv, VALUE io)
|
|
353
364
|
rb_io_event_t events = 0;
|
354
365
|
int i, return_io = 0;
|
355
366
|
|
356
|
-
/* The documented signature for this method is actually incorrect.
|
357
|
-
* A single timeout is allowed in any position, and multiple symbols can be given.
|
358
|
-
* Whether this is intentional or not, I don't know, and as such I consider this to
|
359
|
-
* be a legacy/slow path. */
|
360
367
|
if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) {
|
361
368
|
/* We'd prefer to return the actual mask, but this form would return the io itself: */
|
362
369
|
return_io = 1;
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-wait
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobu Nakada
|
8
8
|
- Charles Oliver Nutter
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-07-15 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Waits until IO is readable or writable without blocking.
|
15
14
|
email:
|
@@ -20,9 +19,12 @@ extensions:
|
|
20
19
|
- ext/io/wait/extconf.rb
|
21
20
|
extra_rdoc_files: []
|
22
21
|
files:
|
22
|
+
- ".document"
|
23
|
+
- ".rdoc_options"
|
23
24
|
- COPYING
|
24
25
|
- Gemfile
|
25
26
|
- README.md
|
27
|
+
- _doc/io.rb
|
26
28
|
- ext/io/wait/depend
|
27
29
|
- ext/io/wait/extconf.rb
|
28
30
|
- ext/io/wait/wait.c
|
@@ -33,7 +35,6 @@ licenses:
|
|
33
35
|
metadata:
|
34
36
|
homepage_uri: https://github.com/ruby/io-wait
|
35
37
|
source_code_uri: https://github.com/ruby/io-wait
|
36
|
-
post_install_message:
|
37
38
|
rdoc_options: []
|
38
39
|
require_paths:
|
39
40
|
- lib
|
@@ -41,15 +42,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
42
|
requirements:
|
42
43
|
- - ">="
|
43
44
|
- !ruby/object:Gem::Version
|
44
|
-
version: '0'
|
45
|
+
version: '3.0'
|
45
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
47
|
requirements:
|
47
48
|
- - ">="
|
48
49
|
- !ruby/object:Gem::Version
|
49
50
|
version: '0'
|
50
51
|
requirements: []
|
51
|
-
rubygems_version: 3.
|
52
|
-
signing_key:
|
52
|
+
rubygems_version: 3.6.7
|
53
53
|
specification_version: 4
|
54
54
|
summary: Waits until IO is readable or writable without blocking.
|
55
55
|
test_files: []
|