Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 递归队列的结果是;“堆栈级别太深”;_Ruby_Stack Overflow_Eventmachine - Fatal编程技术网

Ruby 递归队列的结果是;“堆栈级别太深”;

Ruby 递归队列的结果是;“堆栈级别太深”;,ruby,stack-overflow,eventmachine,Ruby,Stack Overflow,Eventmachine,我正在尝试使用em synchrony1.0.1使此代码正常工作 require "em-synchrony" class Worker attr_reader :station_queue, :list def initialize @station_queue = EM::Queue.new @list = ["value"] * 100 end def run! station_queue.push(*list) station_poppe

我正在尝试使用
em synchrony
1.0.1
使此代码正常工作

require "em-synchrony"
class Worker
  attr_reader :station_queue, :list
  def initialize
    @station_queue = EM::Queue.new
    @list = ["value"] * 100
  end

  def run!
    station_queue.push(*list)
    station_popper = proc do |station|
      # Do some work with #{station}
      station_queue.pop(station_popper)
    end

    station_queue.pop(station_popper)
  end
end

EM::synchrony { Worker.new.run! }

问题是我得到了一个
ruby-1.9.2-p290/gems/em-synchrony-1.0.1/lib/em synchrony.rb:26:堆栈级别太深(SystemStackError)
error。有没有一种方法可以从这样的列表中弹出每个项目,而不会出现堆栈溢出错误?

问题是光纤只能处理4kb的堆栈。 处理一个包含100项的列表将导致它堆叠在流之上

看起来他们正在为光纤实现一个可重组的堆栈。