Quoting Gui Xiaohua (gu...@cn.fujitsu.com): > The child-process wait SIGUSR1 which would be sended by parent-process, > if the child-process execute sigtimedwait() after parent-process send > the signal, it would never receive the SIGUSR1 from parent-process. > I cann't make sure the SIGUSR1 be sended after child-process execute > sigtimedwait() with 100 percent, and i try my best.
Well, in theory I suppose this could happen, but you'd have to have a pretty bad scheduler if the parent can do a strcmp(buf, "c:go") between the pipe read and signal send, while the child goes straight from pipe write to sigtimedwait. Have you seen this signal be missed? If not, then I'd rather assume things are reasonable. If you have seen this happen, then why not instead set up a SIGUSR1 handler in the child before doing the pipe write, then just sleep for 3 seconds instead of doing sigtimedwait? > Signed-off-by: Gui Xiaohua <gu...@cn.fujitsu.com> > --- testcases/kernel/containers/pidns/pidns12-old.c 2009-05-14 > 17:00:20.000000000 +0800 > +++ testcases/kernel/containers/pidns/pidns12.c 2009-05-15 > 15:15:22.000000000 +0800 > @@ -109,7 +109,7 @@ int child_fn(void *arg) > } > > /* Set timeout for sigtimedwait */ > - timeout.tv_sec = 3; > + timeout.tv_sec = 10; > timeout.tv_nsec = 0; > > /* Set mask to wait for SIGUSR1 signal */ > @@ -182,6 +182,9 @@ int main(int argc, char *argv[]) > cleanup(); > } > > + /*Try best to make sure the SIGUSR1 be sended after child-process > execute sigtimedwait*/ > + sleep(5); > + > /* Send SIGUSR1 to container init */ > if (kill(cpid, SIGUSR1) == -1) { > tst_resm(TBROK, "parent: kill() failed(%s).", strerror(errno)); > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list