[Nice-commit] Nice/src/nice/tools/compiler native.nice,1.8,1.9
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2005-02-19 13:23:38
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12934/src/nice/tools/compiler Modified Files: native.nice Log Message: Use threads to read stdout and stderr instead of actively polling for output. Doubles native compilation speed. Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/native.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** native.nice 7 Oct 2004 22:03:41 -0000 1.8 --- native.nice 19 Feb 2005 13:23:18 -0000 1.9 *************** *** 83,104 **** let printer = new PrintWriter(w); ! while (true) ! { ! if (out.ready) ! for (?String line = out.readLine(); line != null; ! line = out.readLine()) ! printer.println(line); ! if (err.ready) ! for (?String line = err.readLine(); line != null; ! line = err.readLine()) ! printer.println(line); ! try { ! return p.exitValue(); ! } ! catch(IllegalThreadStateException e) { ! // The process is not finished yet. ! } ! } } --- 83,102 ---- let printer = new PrintWriter(w); ! let consumeOut = thread(()=> { ! for (?String line = out.readLine(); line != null; line = out.readLine()) ! printer.println(line); ! }); ! let consumeErr = thread(()=> { ! for (?String line = err.readLine(); line != null; line = err.readLine()) ! printer.println(line); ! }); ! consumeOut.start(); ! consumeErr.start(); ! ! consumeOut.join(); ! consumeErr.join(); ! ! return p.waitFor(); } |