I have code in a worker thread that needs to efficiently read a
constantly-growing input stream from a process.
The issue is that the present design uses a sleep() for a short period
if there is no input presently available, and I'd like the attempt to
read the input stream simply *block* so it
Use Java thread synchronization:
http://www.javamex.com/tutorials/synchronization_wait_notify.shtml
Have the reader thread wait when there is no data and the writer
thread notify the reader when more data is available (and when it
should exit its processing loop).
-- Kostya
19.12.2010
2 matches
Mail list logo