This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java.lang.Process.waitFor()


When forking a subprocess in gcj, java.lang.Process.waitFor() may return, before I've
finished reading Process.getInputStream() or Process.getErrorStream().

Does anybody know what the appropriate way is to wait for the inputstream-reading
thread to complete? What I do now, is to create a method "finished()" that will only
return true when the Process.getInputStream() is empty:

		while (!threadOut.finished()) 
		{
			Thread.sleep(50);
		}

Is there a better way to do this? I mean with all the monitor/threading
infrastructure available in gcj, the snippet above probably looks rather primitive.

Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]