Can Ruby Fibers be Concurrent?
Posted
by Jesse J
on Stack Overflow
See other posts from Stack Overflow
or by Jesse J
Published on 2010-06-17T23:48:45Z
Indexed on
2010/06/17
23:53 UTC
Read the original article
Hit count: 304
I'm trying to get some speed up in my program and I've been told that Ruby Fibers are faster than threads and can take advantage of multiple cores. I've looked around, but I just can't find how to actually run different fibers concurrently. With threads you can dO this:
threads = []
threads << Thread.new {Do something}
threads << Thread.new {Do something}
threads.each {|thread| thread.join}
I can't see how to do something like this with fibers. All I can find is yield and resume which seems like just a bunch of starting and stopping between the fibers. Is there a way to do true concurrency with fibers?
© Stack Overflow or respective owner