From: Urabe Shyouhei Date: 2008-11-20T10:34:51+09:00 Subject: [ruby-core:20003] Re: Fibers in 1.8 Brian Mitchell wrote: > On Wed, Nov 19, 2008 at 17:41, Aman Gupta wrote: > >>> Fiber in 1.9 equals to Thread of 1.8. >>> >> How can I implement the Fiber API (Fiber.yield and Fiber#resume) in >> 1.8. Is it possible to use: >> >> rb_thread_save_context(fiber->saved_thread); >> rb_thread_restore_context(fiber->saved_thread, RESTORE_NORMAL); >> >> Aman >> > > It is possible to do something like Fibers quite easily with callcc > but it won't be nearly as efficient or safe. > > Brian. > I'm sorry to inform you that 1.8 threads are implemented on top of callcc, which means, 1.8 threads == ( 1.9 fibers == 1.8 continuations ) + preemption. They all have identical implementation, hence have the exactly same efficacy.