Skip to content

Core Async

Stuart Halloway edited this page Apr 7, 2015 · 5 revisions


The goal of core.async is to decouple producers and consumers of information in software, without dictating specific thread or blocking semantics, and without introducing callback hell. Also, to do all of this as a library, portable anywhere you can run a dialect of Clojure.

Queues are a powerful tool for decoupling software programs. Unfortunately, platforms that have powerful queueing libraries (e.g. Java) may require blocking threads on the ends of the queue. And the world's biggest platform (JavaScript in the browser) doesn't even have queues or threads.

core.async builds upon the work done with Communicating Sequential Processes, and provides:

  • facilities for independent threads of activity, communicating via queue-like channels
  • both real threads and shared use of thread pools (in any combination), as well as ClojureScript on JS engines

What We Will Cover

In this talk, we will cover the design of core.async, and then move directly to exploring core.async's capabilities:

  • Creating unbuffered and buffered channels
  • Threaded put >!! and take <!!
  • Using go blocks to invert control, achieving async without threads
  • IOC put >! and take <!
  • Simultaneously waiting for multiple operations with alts! and alts!!
  • Timeouts as "just another kind of channel"

Finally, we will assemble these primitives into substantial working programs, building toward the Holy Grail of async: substantial UI application development in the browser, with no callbacks in sight.

On the Web

You can’t perform that action at this time.