Skip to content

Commit 30f5a2b

Browse files
ioquatixmatzbot
authored andcommitted
[ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
ruby/io-nonblock@5d3991859c
1 parent 39207b4 commit 30f5a2b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/io/nonblock/nonblock.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ set_fcntl_flags(int fd, int f)
6666
rb_sys_fail(0);
6767
}
6868

69+
#ifndef RUBY_IO_NONBLOCK_METHODS
70+
6971
static int
7072
io_nonblock_set(int fd, int f, int nb)
7173
{
@@ -146,6 +148,8 @@ rb_io_nonblock_set(VALUE self, VALUE value)
146148
return self;
147149
}
148150

151+
#endif /* RUBY_IO_NONBLOCK_METHODS */
152+
149153
static VALUE
150154
io_nonblock_restore(VALUE arg)
151155
{
@@ -193,7 +197,10 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE self)
193197
void
194198
Init_nonblock(void)
195199
{
200+
#ifndef RUBY_IO_NONBLOCK_METHODS
196201
rb_define_method(rb_cIO, "nonblock?", rb_io_nonblock_p, 0);
197202
rb_define_method(rb_cIO, "nonblock=", rb_io_nonblock_set, 1);
203+
#endif
204+
198205
rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1);
199206
}

0 commit comments

Comments
 (0)