Mercurial > forge
changeset 5700:291414cb3c2f octave-forge
fix & improve pipe handling in parcellfun
author | highegg |
---|---|
date | Mon, 01 Jun 2009 07:52:14 +0000 |
parents | 14501bb339c3 |
children | 01df1236689c |
files | main/general/inst/parcellfun.m |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main/general/inst/parcellfun.m Sun May 31 23:27:35 2009 +0000 +++ b/main/general/inst/parcellfun.m Mon Jun 01 07:52:14 2009 +0000 @@ -227,6 +227,15 @@ unwind_protect_cleanup + ## This is enclosed in another handler to prevent errors from escaping. + ## If something goes wrong, we'll get a broken pipe signal, but anything + ## is better than skipping the following __exit__. + try + fclose (statw); + fclose (resw(iproc)); + fclose (cmdr(iproc)); + end_try_catch + ## no more work for us. We call __exit__, which bypasses termination sequences. __exit__ (); @@ -275,10 +284,10 @@ fflush (cmdw(isubp)); ## set pending state pending(isubp) = ijob; - else + elseif (pending(isubp)) ## send terminating signal fwrite (cmdw(isubp), 0, "double"); - fflush (cmdw(isubp)); + fclose (cmdw(isubp)); ## clear pending state pending(isubp) = 0; endif @@ -294,13 +303,12 @@ for isubp = find (pending) ## send terminating signal fwrite (cmdw(isubp), 0, "double"); - fflush (cmdw(isubp)); + fclose (cmdw(isubp)); endfor ## close all pipe ends fclose (statr); for i = 1:nproc - fclose (cmdw(i)); fclose (resr(i)); endfor