philipbohun.com

Glojure by Example: Channel Synchronization

A go block returns a channel that receives the value of its body. Waiting on that channel is the synchronization point: the printer does not run until the worker finishes.

(require '[clojure.core.async :as async])

(println (async/<!
           (async/go
             (println "working")
             "done")))

The body's result is the string done.

$ glj channel-synchronization.glj
working
done

Next example: Select.