diff options
author | Eric Wong <normalperson@yhbt.net> | 2014-02-15 09:53:47 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2014-02-15 09:53:47 +0000 |
commit | 45a6d9eb07fb10cd43748f0d012c6d178a8f33bc (patch) | |
tree | 9c9ac4915ef85083f10082864cba5b3a33bba537 | |
parent | e1391cf65c56ca86030b93375c448b91985dfb7c (diff) | |
download | ruby_io_splice-45a6d9eb07fb10cd43748f0d012c6d178a8f33bc.tar.gz |
rb_thread_blocking_region is not in ruby trunk as of r44955
-rw-r--r-- | ext/io_splice/io_splice_ext.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/ext/io_splice/io_splice_ext.c b/ext/io_splice/io_splice_ext.c index f4745ac..6bf4022 100644 --- a/ext/io_splice/io_splice_ext.c +++ b/ext/io_splice/io_splice_ext.c @@ -80,21 +80,18 @@ static int check_fileno(VALUE io) return fd; } -/* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */ -#if defined(HAVE_RB_THREAD_BLOCKING_REGION) && \ - defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) -/* - * Ruby 1.9 - 2.1 (we use deprecated rb_thread_blocking_region in 2.0+ - * because we can detect (but not use) rb_thread_blocking_region in 1.9.3 - */ +#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H) +/* Ruby 2.0+ */ +# include <ruby/thread.h> +# define WITHOUT_GVL(fn,a,ubf,b) \ + rb_thread_call_without_gvl((fn),(a),(ubf),(b)) +#elif defined(HAVE_RB_THREAD_BLOCKING_REGION) typedef VALUE (*my_blocking_fn_t)(void*); # define WITHOUT_GVL(fn,a,ubf,b) \ rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b)) -#elif defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) /* Ruby 2.2+ */ -#include <ruby/thread.h> -# define WITHOUT_GVL(fn,a,ubf,b) \ - rb_thread_call_without_gvl((fn),(a),(ubf),(b)) + #else /* Ruby 1.8 */ +/* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */ # include <rubysig.h> # define RUBY_UBF_IO ((rb_unblock_function_t *)-1) typedef void rb_unblock_function_t(void *); |