>>>>> "Dalibor" == Dalibor Topic <[EMAIL PROTECTED]> writes:
>> I can't see a way out of the situation either, without creating some
>> kind of dual block (block on *either* the pushback or the underlying
>> stream) or possibly setting a time interval to periodically come back
>> from the underlying stream and check the pushback.
Dalibor> I came up with the following pseudo-code:
Dalibor> [ ... ]
Dalibor> Thread A tries to read a single byte, and blocks. it keeps
Dalibor> acquiring and releasing the lock for the pushbackinputstream
Dalibor> while it blocks.
I think polling like your loop does is a bad idea. I would be very
reluctant to put code like that into the library.
I don't think this is actually a very important bug in practice. I'm
sure Sun's implementation has it too. I just thought it was
interesting from a design point of view.
Dalibor> If you've got this far, I'd like to hear comments :-) I think
Dalibor> that in a cooperative multi-threading environment the yield()
Dalibor> is necessary, since otherwise thread B might not be able to
Dalibor> get any CPU time to unread the byte, but I'm not sure.
Thread.yield() isn't guaranteed to do anything.
Tom
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath