Avoiding Busy-Wait When Opening a Thread's Input Stream
I am trying to avoid using busy wait when, after opening a child thread's input stream, I wait for it it to be ready before I start reading from it. A segment of the code follows:
BufferedReader reader=
new BufferedReader(new InputStreamReader(child.getInputStream()));
while (true){
while (!reader.ready()){}
input = reader.readLine();
// rest of code
}
Any ideas on how to get rid of the tight loop? I thought I wouldn't even need it there since reader is buffered. I thought the thread would just block if I tried to read before it was ready, but without that tight loop there, the code doesn't work.

