May 2018
Beginner to intermediate
290 pages
6h 43m
English
Let’s start with the basics: a thread is the little computing engine that breathes life into your program, turning code into action. In fact, every program that has ever run on the JVM was pushed along by a thread:
| | (ns blottsbooks.threads) |
| | |
| | (defn -main [] |
| | (println "Coming to you live from the main thread!")) |
In the Java world the thread that you get by default, the one that runs your main program, is called the main thread. Things only get interesting—or scary—when you start dealing with a second thread. Or a twenty-fifth thread.
To see this in action in Clojure we can resort to some simple Java interop: there is an aptly named Java class called Thread that will take a Clojure function and run it in ...
Read now
Unlock full access