Feature #3944

Add Fiber#root? method

Added by Mike Perham over 4 years ago. Updated about 1 year ago.

[ruby-core:32777]
Status:Feedback
Priority:Normal
Assignee:Koichi Sasada

Description

=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

History

#1 Updated by Yui NARUSE over 4 years ago

  • Assignee set to Koichi Sasada
  • Status changed from Open to Assigned

=begin

=end

#2 Updated by Lin Jen-Shin over 3 years ago

Any progress on this?

#3 Updated by Koichi Sasada about 3 years ago

  • Description updated (diff)

Sorry for long absent.

I'm not sure why Fiber#root? is needed.
Could you give the examples?
I think if you don't use Fiber#root, then Fiber#root? is not needed.
And I can't understand why Fiber#root is needed.
(I think Fiber#root is for Fiber#transfer)

#4 Updated by Koichi Sasada almost 3 years ago

  • Status changed from Assigned to Feedback

#5 Updated by Koichi Sasada over 2 years ago

  • Target version set to Next Major
  • Status changed from Feedback to Assigned

#6 Updated by Julien A over 2 years ago

what is Next Major ? 3.0 ???
The issue was more than 2 years ago, after looking at the code the implementation should not be a challenge and yet nothing.
it is so depressing watching the ruby redmine seriously...

#7 Updated by Zachary Scott over 2 years ago

Julien please see ruby-core:45849 and also read up on the wiki: http://bugs.ruby-lang.org/projects/ruby/wiki/HowToRequestFeatures

#8 Updated by Koichi Sasada almost 2 years ago

  • Status changed from Assigned to Feedback

#9 Updated by jy j about 1 year ago

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.

#10 Updated by Koichi Sasada about 1 year ago

(2014/05/23 15:17), jjyruby@gmail.com wrote:

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.

Could you break down the description?
I don't know EM::Synchrony.

Why you need to choose root or not root?

--
// SASADA Koichi at atdot dot net

Also available in: Atom PDF