Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Implementing, Abstracting and Benchmarking Lightweight Threads on the JVM. Parent comment
What you can't do is this:
(defn foo [ch] (go (bar ch))) (defn bar [ch] (<! ch))
(defn foo [ch] (thread ; not sure about syntax here (bar ch))) (defn bar [ch] (<!! ch))
BTW, in Pulsar's implementation of core.async, the first example is ok, too.
There are no comments on this comment yet.
What you can't do is this:
foo starts a go block which calls bar, which then blocks on the channel. For threads that's ok: So a function running in a thread can call another function that blocks. A go block can't, that's why go blocks aren't lightweight threads.BTW, in Pulsar's implementation of core.async, the first example is ok, too.