raindrops 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] raindrops 0.19.0 - real-time stats for preforking Rack servers
@ 2017-08-09 23:56  6% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-08-09 23:56 UTC (permalink / raw)
  To: ruby-talk, raindrops-public; +Cc: Dmytro Shteflyuk

raindrops is a real-time stats toolkit to show statistics for Rack HTTP
servers.  It is designed for preforking servers such as unicorn, but
should support any Rack HTTP server on platforms supporting POSIX shared
memory.  It may also be used as a generic scoreboard for sharing atomic
counters across multiple processes.

* https://bogomips.org/raindrops/
* No subscription necessary, no HTML mail:
  raindrops-public@bogomips.org
* mail archives: https://bogomips.org/raindrops-public/
  http://ou63pmih66umazou.onion/raindrops-public/
  nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
  nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
* git clone git://bogomips.org/raindrops.git
* https://bogomips.org/raindrops/NEWS.atom.xml
* Demo site: https://raindrops-demo.bogomips.org:8443/

Changes:

    raindrops 0.19.0 - Rack 2.x middleware compatibility

    This release fixes Rack 2.x compatibility for the few users of
    Raindrops::Middleware
    <https://bogomips.org/raindrops/Raindrops/Middleware.html>.
    Thanks to Dmytro Shteflyuk for this release.

    No need to upgrade unless you use Raindrops::Middleware with
    Rack 2.x.

    There's also a few minor, inconsequential cleanups.

    Dmytro Shteflyuk (1):
          Properly override respond_to? in Raindrops::Middleware::Proxy

    Eric Wong (2):
          Ruby thread compatibility updates
          tcp_info: remove unnecessary extconf.h include
-- 
-_-

^ permalink raw reply	[relevance 6%]

* [PATCH] Ruby thread compatibility updates
@ 2017-04-26  1:10  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-04-26  1:10 UTC (permalink / raw)
  To: raindrops-public

Drop vestigial Ruby 1.8 bits, and start using
rb_thread_call_without_gvl on modern Rubies.
---
 ext/raindrops/extconf.rb        |  1 +
 ext/raindrops/linux_inet_diag.c | 52 ++++++++++++-----------------------------
 2 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index 86c7d78..7570f24 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -112,6 +112,7 @@
 end
 
 have_func("getpagesize", "unistd.h")
+have_func('rb_thread_call_without_gvl')
 have_func('rb_thread_blocking_region')
 have_func('rb_thread_io_blocking_region')
 
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c
index f2db6a5..615c931 100644
--- a/ext/raindrops/linux_inet_diag.c
+++ b/ext/raindrops/linux_inet_diag.c
@@ -1,46 +1,24 @@
 #include <ruby.h>
 #include <stdarg.h>
-#ifdef HAVE_RUBY_ST_H
-#  include <ruby/st.h>
-#else
-#  include <st.h>
-#endif
+#include <ruby/st.h>
 #include "my_fileno.h"
 #ifdef __linux__
 
-/* Ruby 1.8.6+ macros (for compatibility with Ruby 1.9) */
-#ifndef RSTRING_LEN
-#  define RSTRING_LEN(s) (RSTRING(s)->len)
-#endif
-
-/* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */
-#if !defined(HAVE_RB_THREAD_BLOCKING_REGION) && \
-    !defined(HAVE_RB_THREAD_IO_BLOCKING_REGION)
-#  include <rubysig.h>
-#  define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
-typedef void rb_unblock_function_t(void *);
-typedef VALUE rb_blocking_function_t(void *);
-static VALUE
-rb_thread_blocking_region(
-	rb_blocking_function_t *func, void *data1,
-	rb_unblock_function_t *ubf, void *data2)
-{
-	VALUE rv;
-
-	TRAP_BEG;
-	rv = func(data1);
-	TRAP_END;
-
-	return rv;
-}
-#endif /* ! HAVE_RB_THREAD_BLOCKING_REGION */
-
 #ifdef HAVE_RB_THREAD_IO_BLOCKING_REGION
+/* Ruby 1.9.3 and 2.0.0 */
 VALUE rb_thread_io_blocking_region(rb_blocking_function_t *, void *, int);
+#  define rd_fd_region(fn,data,fd) \
+	rb_thread_io_blocking_region((fn),(data),(fd))
+#elif defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && \
+	defined(HAVE_RUBY_THREAD_H) && HAVE_RUBY_THREAD_H
+/* in case Ruby 2.0+ ever drops rb_thread_io_blocking_region: */
+#  include <ruby/thread.h>
+#  define COMPAT_FN (void *(*)(void *))
+#  define rd_fd_region(fn,data,fd) \
+	rb_thread_call_without_gvl(COMPAT_FN(fn),(data),RUBY_UBF_IO,NULL)
 #else
-#  define rb_thread_io_blocking_region(fn,data,fd) \
-      rb_thread_blocking_region((fn),(data),RUBY_UBF_IO,0)
-#endif /* HAVE_RB_THREAD_IO_BLOCKING_REGION */
+#  error Ruby <= 1.8 not supported
+#endif
 
 #include <assert.h>
 #include <errno.h>
@@ -608,7 +586,7 @@ static VALUE tcp_stats(struct nogvl_args *args, VALUE addr)
 	gen_bytecode(&args->iov[2], &query_addr);
 
 	memset(&args->stats, 0, sizeof(struct listen_stats));
-	nl_errcheck(rb_thread_io_blocking_region(diag, args, args->fd));
+	nl_errcheck(rd_fd_region(diag, args, args->fd));
 
 	return rb_listen_stats(&args->stats);
 }
@@ -685,7 +663,7 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
 		         "addr must be an array of strings, a string, or nil");
 	}
 
-	nl_errcheck(rb_thread_io_blocking_region(diag, &args, args.fd));
+	nl_errcheck(rd_fd_region(diag, &args, args.fd));
 
 	st_foreach(args.table, NIL_P(addrs) ? st_to_hash : st_AND_hash, rv);
 	st_free_table(args.table);
-- 
EW


^ 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 --
2017-04-26  1:10  7% [PATCH] Ruby thread compatibility updates Eric Wong
2017-08-09 23:56  6% [ANN] raindrops 0.19.0 - real-time stats for preforking Rack servers Eric Wong

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

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