Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #2552
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail |
|---|---|
| From | 7stud -- <bbxx789_05ss@yahoo.com> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: How to know whether current Fiber is the root Fiber? |
| Date | Fri, 8 Apr 2011 13:56:57 -0500 |
| Organization | Service de news de lacave.net |
| Lines | 51 |
| Message-ID | <306caacb747dfc99c7d49c815ad456cb@ruby-forum.com> (permalink) |
| References | <BANLkTinQAU_BbiTucU5DKxNXiFXyTcE9TQ@mail.gmail.com> <924f39251213390fb702027274090882@ruby-forum.com> |
| NNTP-Posting-Host | bristol.highgroove.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | talisker.lacave.net 1302293611 44474 65.111.164.187 (8 Apr 2011 20:13:31 GMT) |
| X-Complaints-To | abuse@lacave.net |
| NNTP-Posting-Date | Fri, 8 Apr 2011 20:13:31 +0000 (UTC) |
| In-Reply-To | <924f39251213390fb702027274090882@ruby-forum.com> |
| X-Received-From | This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway |
| X-Mail-Count | 381212 |
| X-Ml-Name | ruby-talk |
| X-Rubymirror | Yes |
| X-Ruby-Talk | <306caacb747dfc99c7d49c815ad456cb@ruby-forum.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.ruby:2552 |
Show key headers only | View raw
7stud -- wrote in post #991816:
>
> For example:
>
> require 'fiber'
>
> root_fiber = Fiber.current
>
> f = Fiber.new do
> if Fiber.current.eql?(f)
> puts 'not root fiber'
> else
> puts 'root fiber'
> end
>
> Fiber.yield "hello world"
> end
>
> f.resume
>
> --output:--
> not root fiber
> root fiber
Instead, make that:
require 'fiber'
root_fiber = Fiber.current
f = Fiber.new do
if Fiber.current.eql?(root_fiber)
puts 'root fiber'
else
puts 'not root fiber'
end
Fiber.yield "hello world"
end
f.resume
if Fiber.current.eql?(root_fiber)
puts 'root fiber'
else
puts 'not root fiber'
end
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to know whether current Fiber is the root Fiber? Iñaki Baz Castillo <ibc@aliax.net> - 2011-04-08 07:30 -0500
Re: How to know whether current Fiber is the root Fiber? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-08 13:37 -0500
Re: How to know whether current Fiber is the root Fiber? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-08 13:56 -0500
Re: How to know whether current Fiber is the root Fiber? Iñaki Baz Castillo <ibc@aliax.net> - 2011-04-11 02:30 -0500
Re: How to know whether current Fiber is the root Fiber? Robert Klemme <shortcutter@googlemail.com> - 2011-04-11 02:52 -0500
csiph-web