Nice/src/nice/tools/compiler native.nice,1.8,1.9
Daniel Bonniot <[email protected]>
| Newsgroups | gmane.comp.lang.nice.cvs |
|---|---|
| Message-ID | <[email protected]> |
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();
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click