Weird signal handling bug 221635

Scott James Remnant scott at canonical.com
Fri May 2 17:12:19 BST 2008


On Fri, 2008-05-02 at 17:01 +0100, Colin Watson wrote:

> On Fri, May 02, 2008 at 04:39:56PM +0100, Scott James Remnant wrote:
> > On Thu, 2008-05-01 at 20:24 +0100, Colin Watson wrote:
> > > True, but that's done with:
> > > 
> > > #ifdef SA_RESTART
> > >         /* We rely on getting EINTR from select. */
> > >         sigaction (SIGCHLD, NULL, &sa);
> > >         sa.sa_flags &= ~SA_RESTART;
> > >         sigaction (SIGCHLD, &sa, NULL);
> > > #endif
> > > 
> > > [...]
> > > 
> > > #ifdef SA_RESTART
> > >         sigaction (SIGCHLD, NULL, &sa);
> > >         sa.sa_flags |= SA_RESTART;
> > >         sigaction (SIGCHLD, &sa, NULL);
> > > #endif
> > 
> > This will give you a race condition, but won't cause the bug you're
> > seeing that I know of.
> 
> What's the race condition? I think I'm missing it.
> 
If the signal occurs after or before the select, your select will not
exit on the signal and will sit and wait forever.

Scott
-- 
Scott James Remnant
scott at canonical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20080502/a1b3e610/attachment.pgp 


More information about the ubuntu-devel mailing list