about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/tdb/tdb.c15
1 files 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 <ruby/thread.h>
+#  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 <ruby/thread.h>
-#  define WITHOUT_GVL(fn,a,ubf,b) \
-        rb_thread_call_without_gvl((fn),(a),(ubf),(b))
 #else /* Ruby 1.8 */
 #  include <rubysig.h>
 #  define RUBY_UBF_IO ((rb_unblock_function_t *)-1)