From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Mon, 18 Dec 2006 14:05:46 -0500 To: 9fans@cse.psu.edu Subject: Re: [9fans] wait hang In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: f659498c-ead1-11e9-9d60-3106f5b1d025 On Mon Dec 18 11:49:41 EST 2006, rsc@swtch.com wrote: > You're right. I forgot about "wait". > I reverted the change to rc. > > Note that if you add "wait" to your hanging example > it will not necessarily wait for all of the echos, only > the first 128 or so. > > Russ if i'm reading pwait correctly, it will actually wait for all if them because nwait is now properly incremented and decremented, but the wait message will be discarded if the waitlist is >= 128 when the child exits. do i have this wrong? - erik from port/proc.c 1195 lock(&up->exl); 1196 if(up->nchild == 0 && up->waitq == 0) { 1197 unlock(&up->exl); 1198 error(Enochild); 1199 } 1200 unlock(&up->exl); 1201 1202 sleep(&up->waitr, haswaitq, up); 1203 1204 lock(&up->exl); 1205 wq = up->waitq; 1206 up->waitq = wq->next; 1207 up->nwait--; 1208 unlock(&up->exl); 1209 1210 qunlock(&up->qwaitr); 1211 poperror(); 1212 1213 if(w) 1214 memmove(w, &wq->w, sizeof(Waitmsg));