Liking cljdoc? Tell your friends :D
Clojure only.

hara.concurrent.latch


latchclj

(latch primary follower)
(latch primary follower f)
(latch primary follower f opts)

Followes two irefs together so that when primary changes, the follower will also be updated.

(def primary (atom 1)) (def follower (atom nil))

(latch primary follower #(* 10 %)) (swap! primary inc)

@primary => 2 @follower => 20

Followes two irefs together so that when `primary`
changes, the `follower` will also be updated.

(def primary (atom 1))
(def follower (atom nil))

(latch primary follower #(* 10 %))
(swap! primary inc)

@primary => 2
@follower => 20
raw docstring

unlatchclj

(unlatch primary follower)

Removes the latch so that updates will not be propagated

(def primary (atom 1)) (def follower (atom nil))

(latch primary follower) (swap! primary inc) @primary => 2 @follower => 2

(unlatch primary follower) (swap! primary inc) @primary => 3 @follower => 2

Removes the latch so that updates will not be propagated

(def primary (atom 1))
(def follower (atom nil))

(latch primary follower)
(swap! primary inc)
@primary => 2
@follower => 2

(unlatch primary follower)
(swap! primary inc)
@primary => 3
@follower => 2
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close