Thanks for the explanation, Peter, and for accompanying me on this
journey into the unknown. Your description of enqueue is what chouser
explained to me too.
Someday I have to write some code with a queue named eat so that eat
will pop itself.
Cheers,
Michael
On May 26, 5:54 pm, Peter Schuller
OK, chouser gave me the explanation on IRC. It's amazing that we can
pop into #clojure and there's one of the two people who've touched
this file. Thanks, chouser!
The compareAndSet (CAS) that protects the agent's queue from
overlapping updates forces the agent's actions into serial execution.
Whe
> Where is Action's execute method called in the event the queue is not
> empty?
If the agent's queue was non-empty from the perspective of enqueue(),
that means one of the following is true:
(1) A previous enqueue() has already scheduled the execution of an
action, but it has not yet begun runni
Thanks for your post, Peter. I'm tracing the code, and it's
interesting.
The interesting point is definitely the agent's aq member, the
AtomicReference that wraps an ActionQueue.
The aq.compareAndSet call keeps the value of the ActionQueue from
switching out form under us while we attempt to set
>> Unless I am misunderstanding the context in which the code runs, I
>
> Which I was. Please ignore my previous post (sorry, think before I
> post... think before I post...) and consider me joined in the OP's
> question.
And every time this happens I wonder if I should just leave it to
avoid floo
> Unless I am misunderstanding the context in which the code runs, I
Which I was. Please ignore my previous post (sorry, think before I
post... think before I post...) and consider me joined in the OP's
question.
--
/ Peter Schuller
--
You received this message because you are subscribed to th
> question is about clojure.lang.Agent. In the doRun method, I'm missing
> what prevents a race condition in the updating of the agent's state
> variable.
Unless I am misunderstanding the context in which the code runs, I
believe it is correct because doRun() is guaranteed never to run
concurrentl
I'm preparing a presentation about asynchronous concurrency in
Clojure, and I'm planning on talking a bit about how Clojure's
constructs make good, sensible use of Java's concurrency libraries. My
question is about clojure.lang.Agent. In the doRun method, I'm missing
what prevents a race condition