On Nov 19, 5:05 pm, Stephan Mühlstrasser
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> first of all hello to everybody as I'm new to this group.
>
> I'm starting to learn Clojure, and therefore I studied the ants.clj
> program. It's more or less clear to me how it works, but I stumbled
> across a small detail that made me wonder.
>
> In the "behave" function for the ant agent, there's the "(. Thread
> (sleep ant-sleep-ms))" inside the dosync transaction block. The sleep
> time is pretty short, but doesn't sleeping inside a dosync increase
> the probability that transactions must be restarted? Would it be
> better to put the sleep immediately before the dosync block, or
> doesn't it matter?
>
Yes, it would. Sleeping (blocking, in general) in dosync is very bad
practice - it didn't have much effect in this case, but normally
would.
I've updated ants.clj here on the group.
Thanks for the report,
Rich
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---