(def *dosync-counts* (atom {})
(defn avg-in [map key val]
(let [[avg cnt] (get map key [0 0])]
(assoc map key [(/ (+ (* avg cnt) val) (inc cnt)) (inc cnt)])))
(defmacro logged-dosync [& body]
`(let [count# (atom 0)]
(dosync
(swap! count# inc)
~...@body)
(swap! *dosy
On Wed, Aug 19, 2009 at 11:03 AM, Rich Hickey wrote:
>
> While I appreciate that you are trying to understand the
> implementation of the STM, understanding the semantics of the STM in
> terms of its implementation is wrong-way-around.
>
> The semantics are simpler, and the implementation is subje
On Fri, Aug 14, 2009 at 8:53 PM, Mark Volkmann wrote:
>
> On Fri, Aug 14, 2009 at 4:17 PM, Mark Volkmann
> wrote:
>> On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote:
>>>
I know that if you have a dosync call in some function executed by a
thread, and then that function calls other f
On Aug 14, 2009, at 8:53 PM, Mark Volkmann wrote:
> So it seems the biggest impact of the change can be summarized as
> follows. In the past, once you successfully ensured a Ref, you knew
> you could write to it later because no other thread could also ensure
> it. Now you don't know that. You k
On Fri, Aug 14, 2009 at 4:17 PM, Mark Volkmann wrote:
> On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote:
>>
>>> I know that if you have a dosync call in some function executed by a
>>> thread, and then that function calls other functions (which might have
>>> their own dosyncs, which get bundl
On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote:
>
>> I know that if you have a dosync call in some function executed by a
>> thread, and then that function calls other functions (which might have
>> their own dosyncs, which get bundled together with the original
>> transaction), then everythi
Hi,
On Aug 13, 11:58 am, Chas Emerick wrote:
> That said, I would urge caution in circumstances like what you've
> described.
Additionally, transactions should be kept small. IIRC,
Rich recommended that before. If possible, don't do
complicated calculations inside a transaction.
Sincerely
M
> I know that if you have a dosync call in some function executed by a
> thread, and then that function calls other functions (which might have
> their own dosyncs, which get bundled together with the original
> transaction), then everything is fine. It seems common that all of
> that work would
I know that if you have a dosync call in some function executed by a
thread, and then that function calls other functions (which might have
their own dosyncs, which get bundled together with the original
transaction), then everything is fine. It seems common that all of
that work would be done se