On Thursday 18 December 2008 12:43, Stephan Mühlstrasser wrote: > On Dec 18, 9:24 pm, Randall R Schulz <rsch...@sonic.net> wrote: > > On Thursday 18 December 2008 12:07, Stephan Mühlstrasser wrote: > > > ... > > > > > > Is this use of agents incorrect? > > > > I would say it's an appropriate use, but you need to do it a little > > differently: First of all, use (send-off ...) or you'll have to > > wait for the agent to complete. Then use (await ...) on the agents. > > I do use (await ...) on the agents. And I have also tried (send- > off ...), but it didn't make a difference.
I think I don't understand the difference between (send ...) and (send-off ...), but that may be where the difference in behavior between our otherwise very similar code arises. > > > Why can the program terminate before all the output from the sub- > > > process has been passed through? > > > > As long as the sub-process produces no more output than the > > operating system's pipe buffering limit, it can complete without > > blocking. > > My question was not precise enough. I meant why can the parent > process - the Clojure program - terminate before all all the output > has been passed through. Because it can terminate whenever it wants to. Child processes do not place any constraints upon their parents, at least not on Unix systems. > > > Is there a better way to synchronize with sub-processes in > > > Clojure, or is it necessary to synchronize completely at the Java > > > level? > > > > I don't understand this question. > > As my approach (implement the synchronization at the Clojure level) > doesn't work obviously, I wondered whether it must be done all at the > Java level, e.g. don't use Clojure agents, but create Java threads > explicitly, start them, and wait for completion by using Java > functions. Well, your code may not work at the moment, but the approach is sound, as my code points out (it does work). > > ... > > Thanks for sharing this. At first look it looks similar to my > approach, but there must be a certain important detail that is > different. > > Regards > Stephan Randall Schulz --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---