duan19750503 2012-07-02 18:14
浏览 104
已采纳

在Clojure / Java中相当于Goroutines

I recently enjoyed watching the Google IO talk on Go Concurrency patterns

Although the Go approach to concurrency (groutines, communication over channels) is clearly different to Clojure (immutability, manged references, STM), it seemed like the Go approach could still be useful in some circumstances in a Clojure context.

So is there a direct equivalent in Clojure or Java for Go's concurrency primitives (perhaps a library), in particular:

  • channel-like objects that block until a reader and writer are available at both ends
  • A select-like construct that can wait for results on multiple channels

P.S. Perfectly happy with a Java solution since it would be easy to use from Clojure

UPDATE Since the question was originally asked, Clojure now has core.async which provides all this functionality and more.

  • 写回答

8条回答 默认 最新

  • douliu8327 2014-09-26 01:47
    关注

    You should check out core.async. It is a library written by Rich Hickey that implements go style channels.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料