From 2cca99841650f6d6a8c83ec9b6536128c328bdf5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 Oct 2014 01:42:56 +0000 Subject: fix ruby/thread.h checking under 1.9.3 Thanks to 9d30be3b14e56293cb8402e8c820b89a77460b73[1] for reporting this via private email on 2014-10-03T00:55:55Z [1] - (printf "firstname lastname" | sha1sum) --- ext/tdb/tdb.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ext/tdb/tdb.c b/ext/tdb/tdb.c index 2818a34..2419bef 100644 --- a/ext/tdb/tdb.c +++ b/ext/tdb/tdb.c @@ -94,20 +94,15 @@ rb_hash_aset(hashes,ID2SYM(rb_intern(#x)),ULONG2NUM((unsigned long)rbtdb_##x)) HF(default); } +#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) /* Ruby 2.1+ */ +# include +# define WITHOUT_GVL(fn,a,ubf,b) \ + rb_thread_call_without_gvl((fn),(a),(ubf),(b)) /* 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 - */ +#elif defined(HAVE_RB_THREAD_BLOCKING_REGION) /* Ruby 1.9-2.0 */ 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 -# define WITHOUT_GVL(fn,a,ubf,b) \ - rb_thread_call_without_gvl((fn),(a),(ubf),(b)) #else /* Ruby 1.8 */ # include # define RUBY_UBF_IO ((rb_unblock_function_t *)-1) -- cgit v1.2.3-24-ge0c7