【发布时间】:2022-07-01 06:15:38
【问题描述】:
如何将processor_pool 传递给模块内的方法?
class Dummy
def initialize
processor_pool = Concurrent::FixedThreadPool.new(10)
@threadpool = Module.new do
extend Concurrent::Promises::FactoryMethods
def self.default_executor
return processor_pool # this cannot find the processor_pool variable
end
end
end
end
即使我将其设为@processor_pool 之类的实例变量,我也会遇到同样的错误
【问题讨论】: