From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11250 invoked from network); 2 Feb 2000 08:25:30 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Feb 2000 08:25:30 -0000 Received: (qmail 9952 invoked by alias); 2 Feb 2000 08:25:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9521 Received: (qmail 9943 invoked from network); 2 Feb 2000 08:25:24 -0000 Date: Wed, 2 Feb 2000 09:25:22 +0100 (MET) Message-Id: <200002020825.JAA09210@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 1 Feb 2000 16:35:21 +0000 Subject: Re: PATCH: job-control Bart Schaefer wrote: > ... > > 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. See 9498: it caused problems in a case where jobtab[thisjob] didn't have any procs so that waitjobs() didn't call waitjob() -- and hence no child_whatever(). > Unless this one is happening in a different call to execpline()? Does > the patch below work too? No, because in that case we *were* calling waitjobs(), without any effect, though. > In any case, that last child_block() above should be outside the close > brace. Sorry, I had forgotten about that. Although it may be cleaner to put it directly after the waitjobs() (and call it only if that was called). We could also enhance the test for the child{un,}block() to not call them if we are sure that the waitjob() was called. This patch instead of Bart's. Bye Sven diff -ru ../z.old/Src/exec.c Src/exec.c --- ../z.old/Src/exec.c Tue Feb 1 14:47:35 2000 +++ Src/exec.c Wed Feb 2 09:20:29 2000 @@ -932,6 +932,7 @@ } else { if (newjob != lastwj) { Job jn = jobtab + newjob; + int updated; if (newjob == list_pipe_job && list_pipe_child) _exit(0); @@ -980,10 +981,14 @@ jn->stat |= STAT_NOPRINT; makerunning(jn); } - if (!(jn->stat & STAT_LOCKED)) + if (!(jn->stat & STAT_LOCKED)) { + updated = !!jobtab[thisjob].procs; waitjobs(); - - if (list_pipe_job && jobtab[list_pipe_job].procs && + child_block(); + } else + updated = 0; + if (!updated && + list_pipe_job && jobtab[list_pipe_job].procs && !(jobtab[list_pipe_job].stat & STAT_STOPPED)) { child_unblock(); child_block(); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de