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条)

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突