summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-10-03 01:42:56 +0000
committerEric Wong <normalperson@yhbt.net>2014-10-03 02:02:19 +0000
commit2cca99841650f6d6a8c83ec9b6536128c328bdf5 (patch)
tree110465fe30e82eac39d0d676f08567806557933f
parentbc92b7d99d4d3a15ae467246bbf45aefe2db0c89 (diff)
Thanks to 9d30be3b14e56293cb8402e8c820b89a77460b73[1]
for reporting this via private email on 2014-10-03T00:55:55Z

[1] - (printf "firstname lastname" | sha1sum)
-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)