(alter-on obj f)
(alter-on obj opts? f & args)
A redundant function. Used for testing purposes. The same as
(alter! ref f & args)
but the function is wired with the
notification scheme.
(def atm (atom 0))
(alter-on atm #(do (Thread/sleep 300)
(inc %)))
@atm => 1
A redundant function. Used for testing purposes. The same as `(alter! ref f & args)` but the function is wired with the notification scheme. (def atm (atom 0)) (alter-on atm #(do (Thread/sleep 300) (inc %))) @atm => 1
(dispatch obj f)
(dispatch obj opts? f & args)
Updates the value contained within a ref or atom using another thread. @@(dispatch (atom 0) (fn [x] (Thread/sleep 200) (inc x))) => 1
Updates the value contained within a ref or atom using another thread. @@(dispatch (atom 0) (fn [x] (Thread/sleep 200) (inc x))) => 1
(notify mtf rf)
(notify mtf rf opts)
Creates a watch mechanism so that when a long running function finishes, it returns a promise that delivers the updated iref. (def res (notify #(do (Thread/sleep 200) (state/update % inc)) (ref 1))) res => promise? @res => iref? @@res => 2
Creates a watch mechanism so that when a long running function finishes, it returns a promise that delivers the updated iref. (def res (notify #(do (Thread/sleep 200) (state/update % inc)) (ref 1))) res => promise? @res => iref? @@res => 2
(wait-on mtf rf)
(wait-on mtf rf opts ms ret)
Waits for a long running multithreaded function to update the ref. Used for testing purposes
(def atm (atom 0)) (def f (fn [obj] (dispatch obj #(do (Thread/sleep 300) (inc %))))) (wait-on f atm) @atm => 1
Waits for a long running multithreaded function to update the ref. Used for testing purposes (def atm (atom 0)) (def f (fn [obj] (dispatch obj #(do (Thread/sleep 300) (inc %))))) (wait-on f atm) @atm => 1
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close