我正在尝试使用concurrent-ruby来完成一些并行任务,我正在遵循文档并使用Concurrent::Async
require 'concurrent'
class Echo
include Concurrent::Async
def echo(msg)
p msg
end
end
horn = Echo.new
horn.async.echo('one')
并在终端中运行,但进程不打印任何内容,并立即退出
发布于 2019-10-16 06:32:48
require 'concurrent'
class Echo
include Concurrent::Async
def echo(msg)
p msg
end
end
horn = Echo.new
# t is an instance of Concurrent::IVar which includes Concurrent::Concern::Obligation
t = horn.async.echo('one')
# wait until obligation is complete or the timeout has been reached
t.wait!
https://stackoverflow.com/questions/58386397
复制相似问题