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.posix-mq.general Subject: [PATCH 2/2] avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1 Date: Sat, 15 Feb 2014 13:33:18 +0000 Message-ID: <1392471198-16771-2-git-send-email-normalperson@yhbt.net> References: <1392471198-16771-1-git-send-email-normalperson@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 1392471196 9306 80.91.229.3 (15 Feb 2014 13:33:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Feb 2014 13:33:16 +0000 (UTC) To: ruby.posix.mq@librelist.org Original-X-From: ruby.posix.mq@librelist.org Sat Feb 15 14:33:25 2014 Return-path: Envelope-to: gclrpg-ruby.posix.mq@m.gmane.org List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: ruby.posix.mq@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.posix-mq.general:117 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WEfMw-0001qN-Tk for gclrpg-ruby.posix.mq@m.gmane.org; Sat, 15 Feb 2014 14:33:23 +0100 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 7CC8F75014 for ; Sat, 15 Feb 2014 13:42:23 +0000 (UTC) This will be removed in Ruby 2.2, so avoid the deprecation warning. --- ext/posix_mq/posix_mq.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ext/posix_mq/posix_mq.c b/ext/posix_mq/posix_mq.c index ad8bcff..cbc32b9 100644 --- a/ext/posix_mq/posix_mq.c +++ b/ext/posix_mq/posix_mq.c @@ -95,21 +95,18 @@ static void rb_18_str_set_len(VALUE str, long len) #define rb_str_set_len rb_18_str_set_len #endif /* !defined(HAVE_RB_STR_SET_LEN) */ -/* 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 - */ -typedef VALUE(*my_blocking_fn_t)(void*); +#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_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b)) -#elif defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) /* Ruby 2.2+ */ -#include + 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_call_without_gvl((fn),(a),(ubf),(b)) + rb_thread_blocking_region((my_blocking_fn_t)(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 *); -- 1.9.0.rc3.13.gda73b5f