diff options
-rw-r--r-- | ext/kgio/accept.c | 3 | ||||
-rw-r--r-- | ext/kgio/blocking_io_region.h | 6 | ||||
-rw-r--r-- | ext/kgio/extconf.rb | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/ext/kgio/accept.c b/ext/kgio/accept.c index 902145c..2026a78 100644 --- a/ext/kgio/accept.c +++ b/ext/kgio/accept.c @@ -69,6 +69,7 @@ static VALUE xaccept(void *ptr) #ifdef HAVE_RB_THREAD_BLOCKING_REGION # include <time.h> +# include "blocking_io_region.h" /* * Try to use a (real) blocking accept() since that can prevent * thundering herds under Linux: @@ -82,7 +83,7 @@ static int thread_accept(struct accept_args *a, int force_nonblock) { if (force_nonblock) set_nonblocking(a->fd); - return (int)rb_thread_blocking_region(xaccept, a, RUBY_UBF_IO, 0); + return (int)rb_thread_io_blocking_region(xaccept, a, a->fd); } static void set_blocking_or_block(int fd) diff --git a/ext/kgio/blocking_io_region.h b/ext/kgio/blocking_io_region.h new file mode 100644 index 0000000..c872b53 --- /dev/null +++ b/ext/kgio/blocking_io_region.h @@ -0,0 +1,6 @@ +#ifdef HAVE_RB_THREAD_BLOCKING_REGION +# ifndef HAVE_RB_THREAD_IO_BLOCKING_REGION +# define rb_thread_io_blocking_region(fn,data,fd) \ + rb_thread_blocking_region((fn),(data),RUBY_UBF_IO,0) +# endif +#endif diff --git a/ext/kgio/extconf.rb b/ext/kgio/extconf.rb index d7f1299..a0def1d 100644 --- a/ext/kgio/extconf.rb +++ b/ext/kgio/extconf.rb @@ -27,6 +27,7 @@ have_type("struct RObject") and check_sizeof("struct RObject") check_sizeof("int") have_func('rb_io_ascii8bit_binmode') have_func('rb_thread_blocking_region') +have_func('rb_thread_io_blocking_region') have_func('rb_str_set_len') dir_config('kgio') |