Realizing a lazy-seq is done through a synchronized method see:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L37

No race conditions.

Cedric Greevey writes:

> What, precisely, happens if two threads sharing a reference to a single
> lazy sequence try to realize the same element at the same time? If the
> sequence is completely pure and deterministic, so any attempt to realize a
> particular element will produce a single particular value consistently
> (unlike, say, (repeatedly rand) or a file-seq where relevant parts of the
> filesystem are being concurrently modified), is the worst-case scenario
> that the two threads will redundantly perform the same calculation, with no
> effect other than a minor hit to performance and, in particular, no effect
> on the program semantics?
>
> --

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to