miikka/long-thread

Long-running threads in your Clojure


Keywords
clojure, concurrency, threading
License
EPL-2.0

Documentation

long-thread

A Clojure library for starting and stopping threads. Basically just a wrapper java.lang.Thread.

Usage

(ns example.core
  (:require [long-thread.core :as long-thread]))

(defn my-loop
  []
  (long-thread/until-interrupted
    (println "This is your regularly scheduled greeting: Hello!")
    (Thread/sleep 1000)))

(defn main
  []
  (let [my-thread (long-thread/start "greetings thread" my-loop)]
    (println "Press enter to stop...")
    (read-line)
    (long-thread/stop my-thread)))

License

Copyright © 2018 Miikka Koskinen.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.