From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.io-splice.general Subject: [PATCH] avoid deprecated rb_thread_blocking_region on 2.0+ Date: Sat, 15 Feb 2014 10:14:35 +0000 Message-ID: <20140215101434.GA24906@dcvr.yhbt.net> References: <20140215101434.GA24906@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1392459284 24345 80.91.229.3 (15 Feb 2014 10:14:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Feb 2014 10:14:44 +0000 (UTC) To: ruby.io.splice@librelist.org Original-X-From: ruby.io.splice@librelist.org Sat Feb 15 11:14:53 2014 Return-path: Envelope-to: gclrig-ruby.io.splice@m.gmane.org In-Reply-To: <20140215101434.GA24906@dcvr.yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: ruby.io.splice@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.io-splice.general:50 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WEcGp-0007oN-IY for gclrig-ruby.io.splice@m.gmane.org; Sat, 15 Feb 2014 11:14:51 +0100 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 6E00273E3B for ; Sat, 15 Feb 2014 10:23:52 +0000 (UTC) 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 +# 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 -# 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 # define RUBY_UBF_IO ((rb_unblock_function_t *)-1) typedef void rb_unblock_function_t(void *); -- Eric Wong