sleepy_penguin 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] sleepy_penguin 3.5.0 - Linux I/O events (and more) for Ruby
@ 2017-03-22  7:27  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-22  7:27 UTC (permalink / raw)
  To: ruby-talk, sleepy-penguin

sleepy_penguin provides access to newer, Linux-only system calls to wait
on events from traditionally non-I/O sources.  Bindings to the eventfd,
timerfd, inotify, and epoll interfaces are provided.  Experimental support
for kqueue on FreeBSD (and likely OpenBSD/NetBSD) is also provided.

* homepage: https://bogomips.org/sleepy_penguin/
* git clone git://bogomips.org/sleepy_penguin.git
* Atom feed: https://bogomips.org/sleepy_penguin/NEWS.atom.xml
* mailing list: sleepy-penguin@bogomips.org
* mail archives: https://bogomips.org/sleepy-penguin/
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.sleepy-penguin
	https://bogomips.org/sleepy-penguin/new.atom

Changes:

    sleepy_penguin 3.5.0

    Most notably, kevent and epoll_wait wrappers are now
    nestable, so you can write your own event loops inside
    somebody elses event loop (not that it's a good idea,
    but hey, that's reality, sometimes).

      https://bogomips.org/sleepy_penguin/SleepyPenguin/Kqueue.html#method-i-kevent
      https://bogomips.org/sleepy_penguin/SleepyPenguin/Epoll.html#method-i-wait

    For Linux users, there is now copy_file_range(2) support
    for copying regular files:

      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-copy_file_range

    There is also a new sendfile wrapper which emulates Linux
    sendfile behavior regardless of platform.  It will use the
    native sendfile(2) syscall on FreeBSD and Linux, at least.

      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-linux_sendfile

    Wrappers for the splice(2) and tee(2) syscalls also exist for
    Linux users (vmsplice(2) is omitted):

      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-splice
      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-tee

    Along with some related constants:

      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_GETPIPE_SZ
      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_SETPIPE_SZ
      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_MORE
      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_MOVE
      https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_NONBLOCK

    In other words, this release merges the useful parts of the old
    "io_splice" RubyGem: https://bogomips.org/ruby_io_splice/

    Linux 4.5+ epoll users also get EPOLLEXCLUSIVE along existing
    constants:

      https://bogomips.org/sleepy_penguin/SleepyPenguin/Epoll.html#EXCLUSIVE

    Ruby 1.8 and 1.9 support are both gone, Ruby 2.0.0+ is required
    for keyword args, now(*).

    31 changes since 3.4.1:

          README: fix wording: are => is
          TODO: add memfd item
          epoll: allow :CLOEXEC instead of the long constant
          note the epoll/io.rb file is only for Ruby 1.8
          support the splice(2) and tee(2) syscalls
          implement copy_file_range support for Linux 4.5+
          doc: various URL updates (https)
          unify rb_gc() handling for out-of-FD conditions
          splice: clarification regarding tee() flags
          pkg.mk: various updates from other projects
          copy_file_range: use correct syscall numbers on x86/x86-64
          new API for splice and tee
          doc: remove references to IO#pipe_size accessor
          remove PIPE_BUF constant definition
          copy_file_range: move wrapper to Ruby for keyword arg handling
          gemspec: use SPDX-compatible license specifier
          implement linux_sendfile support
          portability fixes for systems w/o splice, copy_file_range
          tests: switch to test-unit
          free buffer if pthread_setspecific fails
          allow nestable TLS buffers within the same thread
          drop unused Ruby 1.8 support code
          epoll: add newline to Kernel#warn messages for atomicity
          favor require_relative over require
          epoll: add EPOLLEXCLUSIVE constant and documentation
          kqueue: remove IO#autoclose= and 1.8-related checks
          sp_copy: remove dummy 1.8 code for non-native threaded Ruby
          build: remove build-time olddoc dependency
          copy_file_range: add documentation
          doc: tests and examples for changing pipe size in Linux
          doc: avoid incorrect links to Epoll::IO

(*) Even ruby 2.1 is unsupported by ruby-core upstream;
    but I could be prodded to re-add 1.9.3 support if
    somebody really wants it...

^ permalink raw reply	[relevance 7%]

* [PATCH] doc: avoid incorrect links to Epoll::IO
@ 2017-03-22  7:19  6% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-22  7:19 UTC (permalink / raw)
  To: sleepy-penguin

Most of the time, we want the core "IO" class, but rdoc wants
to be clever...
---
 ext/sleepy_penguin/epoll.c  | 22 +++++++++++-----------
 lib/sleepy_penguin/epoll.rb | 16 ++++++++--------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c
index 09c4bf7..d692f18 100644
--- a/ext/sleepy_penguin/epoll.c
+++ b/ext/sleepy_penguin/epoll.c
@@ -102,7 +102,7 @@ static VALUE s_new(VALUE klass, VALUE _flags)
  * Register, modify, or register a watch for a given +io+ for events.
  *
  * +op+ may be one of +EPOLL_CTL_ADD+, +EPOLL_CTL_MOD+, or +EPOLL_CTL_DEL+
- * +io+ is an IO object or one which proxies via the +to_io+ method.
+ * +io+ is an +IO+ object or one which proxies via the +to_io+ method.
  * +events+ is an integer mask of events to watch for.
  *
  * Returns nil on success.
@@ -187,7 +187,7 @@ static VALUE real_epwait(struct ep_per_thread *ept)
  * call-seq:
  *	ep_io.epoll_wait([maxevents[, timeout]]) { |events, io| ... }
  *
- * Calls epoll_wait(2) and yields Integer +events+ and IO objects watched
+ * Calls epoll_wait(2) and yields Integer +events+ and +IO+ objects watched
  * for.  +maxevents+ is the maximum number of events to process at once,
  * lower numbers may prevent starvation when used by epoll_wait in multiple
  * threads.  Larger +maxevents+ reduces syscall overhead for
@@ -251,7 +251,7 @@ void sleepy_penguin_init_epoll(void)
 	 *
 	 * The Epoll class provides high-level access to epoll(7)
 	 * functionality in the Linux 2.6 and later kernels.  It provides
-	 * fork and GC-safety for Ruby objects stored within the IO object
+	 * fork and GC-safety for Ruby objects stored within the +IO+ object
 	 * and may be passed as an argument to IO.select.
 	 */
 	cEpoll = rb_define_class_under(mSleepyPenguin, "Epoll", rb_cObject);
@@ -260,7 +260,7 @@ void sleepy_penguin_init_epoll(void)
 	 * Document-class: SleepyPenguin::Epoll::IO
 	 *
 	 * Epoll::IO is a low-level class.  It does not provide fork nor
-	 * GC-safety, so Ruby IO objects added via epoll_ctl must be retained
+	 * GC-safety, so Ruby +IO+ objects added via epoll_ctl must be retained
 	 * by the application until IO#close is called.
 	 */
 	cEpoll_IO = rb_define_class_under(cEpoll, "IO", rb_cIO);
@@ -271,13 +271,13 @@ void sleepy_penguin_init_epoll(void)
 
 	rb_define_method(cEpoll, "__event_flags", event_flags, 1);
 
-	/* registers an IO object via epoll_ctl */
+	/* registers a target +IO+ object via epoll_ctl */
 	rb_define_const(cEpoll, "CTL_ADD", INT2NUM(EPOLL_CTL_ADD));
 
-	/* unregisters an IO object via epoll_ctl */
+	/* unregisters a target +IO+ object via epoll_ctl */
 	rb_define_const(cEpoll, "CTL_DEL", INT2NUM(EPOLL_CTL_DEL));
 
-	/* modifies the registration of an IO object via epoll_ctl */
+	/* modifies the registration of a target +IO+ object via epoll_ctl */
 	rb_define_const(cEpoll, "CTL_MOD", INT2NUM(EPOLL_CTL_MOD));
 
 	/* specifies whether close-on-exec flag is set for Epoll.new */
@@ -309,9 +309,9 @@ void sleepy_penguin_init_epoll(void)
 #ifdef EPOLLEXCLUSIVE
 	/*
 	 * Sets an exclusive wakeup mode for the epoll object
-	 * that is being attached to the target IO.  This
+	 * that is being attached to the target +IO+.  This
 	 * avoids thundering herd scenarios when the same
-	 * target IO is shared among multiple epoll objects.
+	 * target +IO+ is shared among multiple epoll objects.
 	 * Available since Linux 4.5
 	 */
 	rb_define_const(cEpoll, "EXCLUSIVE", UINT2NUM(EPOLLEXCLUSIVE));
@@ -322,13 +322,13 @@ void sleepy_penguin_init_epoll(void)
 
 	/*
 	 * watch for errors, there is no need to specify this,
-	 * it is always monitored when an IO is watched
+	 * it is always monitored when an +IO+ is watched
 	 */
 	rb_define_const(cEpoll, "ERR", UINT2NUM(EPOLLERR));
 
 	/*
 	 * watch for hangups, there is no need to specify this,
-	 * it is always monitored when an IO is watched
+	 * it is always monitored when an +IO+ is watched
 	 */
 	rb_define_const(cEpoll, "HUP", UINT2NUM(EPOLLHUP));
 
diff --git a/lib/sleepy_penguin/epoll.rb b/lib/sleepy_penguin/epoll.rb
index da1502e..4d23968 100644
--- a/lib/sleepy_penguin/epoll.rb
+++ b/lib/sleepy_penguin/epoll.rb
@@ -45,7 +45,7 @@ class SleepyPenguin::Epoll
     end
   end
 
-  # Calls epoll_wait(2) and yields Integer +events+ and IO objects watched
+  # Calls epoll_wait(2) and yields Integer +events+ and +IO+ objects watched
   # for.  +maxevents+ is the maximum number of events to process at once,
   # lower numbers may prevent starvation when used by epoll_wait in multiple
   # threads.  Larger +maxevents+ reduces syscall overhead for
@@ -62,7 +62,7 @@ class SleepyPenguin::Epoll
     end
 
     # we keep a snapshot of @marks around in case another thread closes
-    # the IO while it is being transferred to userspace.  We release mtx
+    # the io while it is being transferred to userspace.  We release mtx
     # so another thread may add events to us while we're sleeping.
     @io.epoll_wait(maxevents, timeout) { |events, io| yield(events, io) }
   ensure
@@ -87,7 +87,7 @@ class SleepyPenguin::Epoll
   # call-seq:
   #     ep.del(io) -> 0
   #
-  # Disables an IO object from being watched.
+  # Disables an +IO+ object from being watched.
   def del(io)
     fd = io.to_io.fileno
     @mtx.synchronize do
@@ -125,7 +125,7 @@ class SleepyPenguin::Epoll
   # call-seq:
   #     epoll.mod(io, flags) -> 0
   #
-  # Changes the watch for an existing IO object based on +events+.
+  # Changes the watch for an existing +IO+ object based on +events+.
   # Returns zero on success, will raise SystemError on failure.
   def mod(io, events)
     events = __event_flags(events)
@@ -214,8 +214,8 @@ class SleepyPenguin::Epoll
   # call-seq:
   #     ep.io_for(io) -> object
   #
-  # Returns the given IO object currently being watched for.  Different
-  # IO objects may internally refer to the same process file descriptor.
+  # Returns the given +IO+ object currently being watched for.  Different
+  # +IO+ objects may internally refer to the same process file descriptor.
   # Mostly used for debugging.
   def io_for(io)
     fd = __fileno(io)
@@ -244,9 +244,9 @@ class SleepyPenguin::Epoll
   # call-seq:
   #     epoll.include?(io) -> true or false
   #
-  # Returns whether or not a given IO is watched and prevented from being
+  # Returns whether or not a given +IO+ is watched and prevented from being
   # garbage-collected by the current Epoll object.  This may include
-  # closed IO objects.
+  # closed +IO+ objects.
   def include?(io)
     fd = __fileno(io)
     @mtx.synchronize do
-- 
EW


^ permalink raw reply related	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-03-22  7:19  6% [PATCH] doc: avoid incorrect links to Epoll::IO Eric Wong
2017-03-22  7:27  7% [ANN] sleepy_penguin 3.5.0 - Linux I/O events (and more) for Ruby Eric Wong

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

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