b.com/Chouser/456326 to
>> > study how the history in refs works. See the accompanying discussion at
>> > http://clojure-log.n01se.net/date/2010-06-28.html. I've been using
>> variants
>> > of that stress test to explain the ref history behavior since then and
&g
ay want to use the code from https://gist.github.com/Chouser/456326to
> > study how the history in refs works. See the accompanying discussion at
> > http://clojure-log.n01se.net/date/2010-06-28.html. I've been using
> variants
> > of that stress test to explain the ref history
refs works. See the accompanying discussion at
> http://clojure-log.n01se.net/date/2010-06-28.html. I've been using variants
> of that stress test to explain the ref history behavior since then and
> people seem to be happy with it.
>
> Kudos to chouser obviously!
>
>
You may want to use the code from https://gist.github.com/Chouser/456326 to
study how the history in refs works. See the accompanying discussion at
http://clojure-log.n01se.net/date/2010-06-28.html. I've been using
variants of that stress test to explain the ref history behavior since
Thanks guys. I have been able to get the ref-history-count greater than 0
by increasing ref-min-history to something greater than 0 and by using long
(using Thread/sleep) running transactions.
Now i get it
Josh
On Thu, May 30, 2013 at 6:01 PM, Neale Swinnerton wrote:
>
> On Thu, May 30
On Thu, May 30, 2013 at 3:05 PM, Josh Kamau wrote:
>
> I am trying to understand (ref-history-count ref) . I thought it counts
> the number of "old" values in the ref. But in all my tests, its always
> returning zero. How is it used?
>
In clojure's STM, history
ref-count only increment when one of the following occurs:
* min-history > 0
* ref-read-faults > 0 && current-ref-history-count < max-history-count.
;; ref-count increment because min-history > 0
(let [r (ref 1 :min-history 1)
f1 (future (dosyn
(def my-ref (ref 1))
(defn update-my-ref
[new-value]
(dosync
(alter my-ref #(+ % new-value))
(ref-history-count my-ref)))
Hi guys ;
I am trying to understand (ref-history-count ref) . I thought it counts the
number of "old" values in the ref. But in all my tests,
On Jan 10, 6:21 pm, Dragan Djuric wrote:
> Is this on purpose (and what is the reason), or it's just that nobody
> thought that would be useful?
>
> Of course, I am talking about the read-only access to the history.
[snip...]
To minimize memory consumption, refs only keep history if it is neede
On Jan 10, 9:21 am, Dragan Djuric wrote:
> I am aware that there are functions for seeing history count, min
> count etc.
> Why is the actual history hidden?
> For example, if there is a ref:
> (def a (ref 1))
> (dosync (alter a 2))
> (dosync (alter a 3))
> (ref-history-
I am aware that there are functions for seeing history count, min
count etc.
Why is the actual history hidden?
For example, if there is a ref:
(def a (ref 1))
(dosync (alter a 2))
(dosync (alter a 3))
(ref-history-ocunt a)
=>2
a
=>3
Why this is not allowed?:
(ref-history a)
=> (2 1)
11 matches
Mail list logo