Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: job-control



On Feb 1, 11:58am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: job-control
}
} 
} I wrote:
} 
} > But removing those two child_* and
} > adding:
} > 
} >   if (list_pipe_job && jobtab[list_pipe_job].procs &&
} >       !(jobtab[list_pipe_job].stat & STAT_STOPPED))
} >       child_suspend(0);
} > 
} > before the if (!list_pipe_child && ...) fixes the problem, too and is
} > almost certainly better. Can anyone see a problem with this?
} 
} No, we would also need a child_block, then, so we can use
} child_unblock()/child_block() after this test.

Waitaminute, now I'm *really* confused.

} -		if (!(jn->stat & STAT_LOCKED)) {
} -		    child_unblock();
} +		if (!(jn->stat & STAT_LOCKED))
}  		    waitjobs();
} +
} +		if (list_pipe_job && jobtab[list_pipe_job].procs &&
} +		    !(jobtab[list_pipe_job].stat & STAT_STOPPED)) {
} +		    child_unblock();
}  		    child_block();
}  		}

So now you're saying it works to do the child_unblock() *after* the
waitjobs() rather than before?  That makes no sense; waitjobs() does
a child_unblock() at the end.  So if the previous child_unblock()
(inside the !STAT_LOCKED test) worked, then waitjobs() was getting
called, and this child_unblock() shouldn't make any difference.

Unless this one is happening in a different call to execpline()?  Does
the patch below work too?

In any case, that last child_block() above should be outside the close
brace.

Index: Src/exec.c
===================================================================
@@ -981,13 +981,11 @@
 		    makerunning(jn);
 		}
 		if (!(jn->stat & STAT_LOCKED))
-		    waitjobs();
-
-		if (list_pipe_job && jobtab[list_pipe_job].procs &&
-		    !(jobtab[list_pipe_job].stat & STAT_STOPPED)) {
-		    child_unblock();
-		    child_block();
-		}
+		    waitjobs();      /* Implicit child_unblock() */
+		else if (list_pipe_job && jobtab[list_pipe_job].procs &&
+		    !(jobtab[list_pipe_job].stat & STAT_STOPPED))
+		    child_unblock(); /* Permit job table update */
+		child_block();       /* Freeze job table again */
 		if (list_pipe_child &&
 		    jn->stat & STAT_DONE &&
 		    lastval2 & 0200)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author