I'm trying to do something with "neverblock" and I can't seem to get it to work.
What I expect: The blocking sleep shouldn't slow down the whole process. I expected to see 5 times "bla" with basically the same timestamp.
Ruby:
$ ruby --version
ruby 1.9.2dev (2010-03-31 trunk 27123) [x86_64-darwin10.2.0]
Code:
require "neverblock"
fiber_pool = NeverBlock::Pool::FiberPool.new(25)
5.times do
fiber_pool.spawn do
puts "bla @ #{Time.now}"
sleep 1
end
end
Result:
$ ruby test.rb
Using Neverblock
bla @ 2010-04-07 11:00:28 -0400
bla @ 2010-04-07 11:00:29 -0400
bla @ 2010-04-07 11:00:30 -0400
bla @ 2010-04-07 11:00:31 -0400
bla @ 2010-04-07 11:00:32 -0400