Tom Tromey wrote:
>Suppose a thread calls PushbackInputStream.read and there are no bytes
>to be read. So the thread blocks.
>
>Now suppose another thread calls PushbackInputStream.unread.
>
>Ideally you'd expect the first thread to wake up and read the
>pushed-back bytes. However, this doesn't happen. And in fact it
>isn't easy to make it happen. I think you could do it by making a new
>thread inside PushbackInputStream.read. That is awfully heavy though.
>
In general, I dont think its useful/safe to have more than one thread
reading from any given InputStream, so in practise this probibly isnt a
problem. Besides, even if there was a way to unblock another reading
thread, there would still be consistency issues. If thread A reads a
chunk of data, then thread B reads a chunk, then thread A decides to
push back a byte, that byte would no longer be in the correct position
on the stream.
regards
Bryce
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath