[ruby-core:62708] [ruby-trunk - Feature #3944] Add Fiber#root? method

From: jjyruby@...
Date: 2014-05-23 06:17:44 UTC
List: ruby-core #62708
Issue #3944 has been updated by jy j.


Fiber#root is useful.
For example, I want write a method, when under EM::Synchrony environment it should use EM::Synchrony call(in fact is async call, and writing in sync, power by fiber), and when under Fiber#root, it should use sync call, so I need detect whether current fiber is root fiber.

----------------------------------------
Feature #3944: Add Fiber#root? method
https://bugs.ruby-lang.org/issues/3944#change-46832

* Author: Mike Perham
* Status: Feedback
* Priority: Normal
* Assignee: Koichi Sasada
* Category: 
* Target version: Next Major
----------------------------------------
=begin
 Since the root fiber is treated differently than other Fibers (e.g. you can't yield from the root), code which can optionally use fibers for high-performance IO (in my case, the Mysql2 driver) needs Fiber#root? to know when it can use Fibers to execute a query versus using a standard blocking call.
=end




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next