posix_mq RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] posix_mq 2.1.0 - ensure compatibility with future Rubies
@ 2014-02-15 13:38  6% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-02-15 13:38 UTC (permalink / raw)
  To: ruby.posix.mq

* avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
* prepare for rb_thread_blocking_region removal

* http://bogomips.org/ruby_posix_mq/
* ruby.posix.mq@librelist.org
* git://bogomips.org/ruby_posix_mq.git
* http://bogomips.org/ruby_posix_mq/NEWS.atom.xml


^ permalink raw reply	[relevance 6%]

* [PATCH 2/2] avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
  @ 2014-02-15 13:33  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-02-15 13:33 UTC (permalink / raw)
  To: ruby.posix.mq

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 <ruby/thread.h>
 #  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>
+        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 <rubysig.h>
 #  define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
 typedef void rb_unblock_function_t(void *);
-- 
1.9.0.rc3.13.gda73b5f



^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-02-15 13:33     [PATCH 1/2] prepare for rb_thread_blocking_region removal Eric Wong
2014-02-15 13:33  7% ` [PATCH 2/2] avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1 Eric Wong
2014-02-15 13:38  6% [ANN] posix_mq 2.1.0 - ensure compatibility with future Rubies Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_posix_mq.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).