io_splice RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: ruby.io.splice@librelist.org
Subject: [PATCH] avoid deprecated rb_thread_blocking_region on 2.0+
Date: Sat, 15 Feb 2014 10:14:35 +0000	[thread overview]
Message-ID: <20140215101434.GA24906@dcvr.yhbt.net> (raw)
In-Reply-To: <20140215101434.GA24906@dcvr.yhbt.net>

rb_thread_blocking_region is not in ruby trunk as of r44955
---
 ext/io_splice/io_splice_ext.c | 19 ++++++++-----------
 1 file 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 *);
-- 
Eric Wong



           reply	other threads:[~2014-02-15 10:14 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20140215101434.GA24906@dcvr.yhbt.net>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/ruby_io_splice/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140215101434.GA24906@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=ruby.io.splice@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_io_splice.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).