From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 20E50211B3 for ; Thu, 29 Nov 2018 11:26:10 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id EC773120CE3; Thu, 29 Nov 2018 20:26:07 +0900 (JST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by neon.ruby-lang.org (Postfix) with ESMTPS id 87ED1120CD7 for ; Thu, 29 Nov 2018 20:26:04 +0900 (JST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 57B84211B3; Thu, 29 Nov 2018 11:26:02 +0000 (UTC) Date: Thu, 29 Nov 2018 11:26:02 +0000 From: Eric Wong To: ruby-core@ruby-lang.org Message-ID: <20181129112602.rgfyftuvb5v5bz75@dcvr> References: <20181129001606.dkrnkr7ea6bvjiui@dcvr> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181129001606.dkrnkr7ea6bvjiui@dcvr> X-ML-Name: ruby-core X-Mail-Count: 90161 Subject: [ruby-core:90161] Thread::Light#run and Thread::Light#wakeup X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Eric Wong wrote: > samuel@oriontransfer.net wrote: > > @k0kubun I like the general ideas presented here but the > > implementation is too heavy/specific for my use case. For > > example, it won't work on JRuby, TruffleRuby, or other > > implementations. That's the major benefit of using a gem for > > the reactor implementation. > > Fiber doesn't really benefit (in terms of memory use) on JRuby, > either, right? I don't know much about implementations outside > of this one. > > > Additionally, I need to use Fiber for task switching. Does > > `Thread::Light` allow `yield`/`resume`? > > We can expose yield/resume easily; but I don't know if there > is use case for it... There is already Kernel#sleep support > and Thread::Light#run So Thread::Light#run wakes up from IO#wait as well; but that's fixable. I also noticed I implemented Thread::Light#wakeup as an alias of Thread::Light#run; because I wanted to avoid extra allocation. Thread#wakeup doesn't invoke the scheduler, #run does; so I want ::Light to match that semantic.