I can precisely exemplify the behavior here: https://gist.github.com/MichaelDrogalis/6123177
On Wednesday, July 31, 2013 11:13:17 AM UTC-4, Michael Drogalis wrote: > > Aaron: Yep, I'm aware - and am using the value provided by the last > parameter. > > This is going to be tough to show the problem without bringing more > details of my concurrency set up. > I'm not sure if this will exhibit the problem, but this is what it boils > down to: > > https://gist.github.com/MichaelDrogalis/6122834 > > When enough threads are trying to write to the queue, the watches > triggered later can finish before watches triggered earlier. > > > On Wednesday, July 31, 2013 11:05:16 AM UTC-4, Aaron Cohen wrote: >> >> A watcher fn has 4 parameters: key, reference, old-state, new-state >> >> If you use old-state and new-state rather than the reference, you should >> not see your problem. >> >> --Aaron >> >> >> On Wed, Jul 31, 2013 at 11:00 AM, Michael Drogalis <madru...@gmail.com>wrote: >> >>> Problem: >>> >>> I have a ref representing a queue of people in line. >>> I add a watch to the ref to print out the contents of the queue whenever >>> it changes. >>> Naturally, and expected, the following can happen if queuing happens in >>> rapid succession: >>> >>> Queue: [] >>> <add "Mike" to queue> >>> <add "John" to queue> >>> >>> console: "Queue is Mike, John" >>> console: "Queue is Mike" >>> >>> I'd like to write a UI for this program, but I clearly can't reliably >>> render based on the result delivered >>> by the add-watch hook. What's the solution for this problem? >>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- -- 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.