From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: normalperson@yhbt.net Received: from zedshaw2.xen.prgmr.com (zedshaw2.xen.prgmr.com [71.19.156.177]) by dcvr.yhbt.net (Postfix) with ESMTP id D80121F6C9 for ; Thu, 11 Apr 2013 04:18:14 +0000 (UTC) Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id B2B6873DFA for ; Thu, 11 Apr 2013 04:18:44 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 11 Apr 2013 04:17:29 +0000 From: Eric Wong In-Reply-To: <1365653855-1101-1-git-send-email-normalperson@yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Message-Id: <1365653855-1101-1-git-send-email-normalperson@yhbt.net> Precedence: list References: <1365653855-1101-1-git-send-email-normalperson@yhbt.net> Sender: sleepy.penguin@librelist.org Subject: [sleepy.penguin] [PATCH 0/6] epoll wrapper cleanups To: sleepy.penguin@librelist.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I've decided to provide lower-level access to epoll users without the extra overhead of automatic GC marking and Epoll#set management. The normal Epoll class is now implemented in Ruby, while the low-level Epoll::IO class is a lightweight C wrapper. This should make code easier to maintain, and folks that really want good concurrency can use Epoll::IO directly (without the GC-safety normal Epoll provides). I'm also deprecating the Epoll#set and Epoll#delete APIs, since they're expensive to maintain. They will be removed in sleepy_penguin 4.0 (probably 12 months or so). I've also made Epoll thread-safe for Rubinius, as Rubinius C extensions do not (or will not) hold any global lock, so the @marks array must be protected. Epoll::IO does not need additional locking to be thread-safe, it uses thread-local storage and the kernel eventpoll struct is already protected by its internal locking. Most of these changes have been my experiences in using epoll in recent years (mostly outside of Ruby) and also close inspection (and some hacking :) of the epoll implementation in Linux. I'll document these patches more, later, and push. ext/sleepy_penguin/epoll.c | 633 ++++++--------------------------------- ext/sleepy_penguin/epoll_green.h | 8 +- ext/sleepy_penguin/inotify.c | 11 +- lib/sleepy_penguin.rb | 1 + lib/sleepy_penguin/epoll.rb | 266 ++++++++++++++++ test/test_epoll.rb | 31 +- test/test_epoll_io.rb | 24 ++ test/test_epoll_optimizations.rb | 2 +- 8 files changed, 418 insertions(+), 558 deletions(-)