[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Note on PushbackInputStream

From: Tom Tromey
Subject: Note on PushbackInputStream
Date: 06 Aug 2001 17:05:21 -0600

While merging PushbackInputStream this weekend, I found a bug in both
the Classpath and libgcj versions.  Actually I think it is a a design
bug and not a bug in our implementations.

Suppose a thread calls 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  That is awfully heavy though.

Maybe the new 1.4 I/O stuff addresses this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]