Ruby Agent: Go-Like Concurrency in Ruby

sakura79 · 2014年06月25日 · 最后由 Kabie 回复于 2014年06月25日 · 1603 次阅读

有点意思,就是不知道性能和稳定性怎样。看 GitHub 貌似项目开始挺早了。

http://www.sitepoint.com/agent-go-like-concurrency-ruby/

require 'agent'

chan = channel!(Integer)

go! do
  #the program should only end
  #when this goroutine ends
  sleep 10

  puts "Hello, world!"
  chan << 1
end

puts chan.receive.first

项目主页:https://github.com/igrigorik/agent

CSP, interesting...

有趣。。。不过性能肯定差一些……毕竟是 ruby 级的。。。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号