[lkml]   [2000]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Using alarm() to break out of socket accept
    Edgar Toernig <> writes:

    > Alan Cox wrote:
    > >
    > > > We have code that uses an alarm() to routinely break ouf of a socket accept
    > > > and then perform some processing (check a flag) and then loop back around
    > > > to wait for a connection again. The code works fine on Solaris, HP-UX,,
    > > > AIX, and other flavours but not on RedHat 6.0.
    > >
    > > Ugly way to do it (non blocking connect and select() is cleaner)
    > >
    > > > I noticed that by default, SIGALRM is ignored so I unblocked it with
    > > > sigprocmask but we are still not getting the behaviour we require.
    > > > Is there something I am missing here?
    > >
    > > Are you using sigaction to force the signal to interrupt connect and not
    > > be restartable ?
    > In a similar case I noticed that SA_RESTART is ignored for select().
    > IMO a very strange behaviour! Is the xview clock binary really the
    > only reason???

    If select was restarted it would wait its timeout again.
    With a SIGALRM timer in just the right period you could make a select()
    block forever, even if it was supposed to timeout. This happens in practice,
    e.g. with some versions of the DNS resolver when you have a periodic timer
    running. Fixing this would complicate the system call restart mechanism a lot
    and also probably break some programs.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:57    [W:0.022 / U:120.512 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site