Hi,

On 26 Apr., 13:27, Per Vognsen <per.vogn...@gmail.com> wrote:

> Okay, that is a blatant infinite loop that has nothing to do with
> deadlocks. I give up. This combination of laziness and concurrency and
> locking is giving me a headache. Sorry about the distraction,
> everyone.

Well, we can step through the code and see whether this sheds some
light on the issue.

Calling .seq on zs, which is meant by "forcing", I believe.

  zs.seq()
    sval()
      ; fn != null since zs was not forced before.
      sv = fn.invoke()
      ; sv is a Cons, namely (cons 26 as)
      fn = null
      return sv
    ; Up to now no chance of deadlock. Back to seq()
    ; sv != null
    ls = sv
    sv = null
    ; a Cons is not an instance of LazySeq
    s = RT.seq(ls)
    ; s == ls since .seq is the identity on a Cons
    return s
    ; Still no chance of deadlock.

There is no other way to force a sequence in Clojure than traversing
it
via next/rest, which implicitely call seq on the rest. So even in the
circular case there is no chance of deadlock.

The recursive .sval() call is for lazy-seq evaluating to lazy-seqs.
ie. (lazy-seq (lazy-seq ...)). Here - again - is no chance of
deadlock.

Does this make sense?

Sincerely
Meikel

-- 
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

Reply via email to