On Sunday 07 December 2008 15:45, prhlava wrote:
> > > The following does not work, but if I remove the (while true , it
> > > does...
> >
> > Characterize "does not work," if you would.
>
> Well, nothing happens with "(while" around the code... But if I take
> the "while" out, and run the remaining code, it does what expected
> - prints the content of the buffer (once, of course).
You wrote:

> (while true
>        (with-open [pipe (new java.io.FileInputStream pipe-name)]
>          (print pipe)
>          (let [buffer (make-array Byte/TYPE buffer-size)]
>            (. pipe read buffer)
>            (map print buffer))))

You're asking for the pipe to be repeatedly opened, one uninterrupted 
glob of bytes read and processed and then the pipe closed. Is that 
really what you intend?

As written, this suggest a kind of "daemon" that monitors the pipe, 
waiting for successive writers, each of which must write everything 
they want processed by the far side in a single write call and 
furthermore that transmission must not exceed the operating system's 
pipe high-water mark. All this seems a bit fragile to me.

But more practically, you should _say_ what you want your code to 
accomplish.


> > (explanations snipped)
>
> Thanks for the explanations, the blocking is not a problem. ...

It was not clear whether or not your mention of the blocking behavior 
was something you considered unexpected or problematic.


> Vlad


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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to