This is the mail archive of the
mailing list for the Cygwin project.
Re: connect() not interrupted by sigalrm?
- From: "Elfyn McBratney" <elfyn-cygwin at exposure dot org dot uk>
- To: "cygwin" <cygwin at cygwin dot com>,"Eric Mandel" <eric at head-cfa dot harvard dot edu>
- Date: Mon, 24 Feb 2003 18:28:33 -0000
- Subject: Re: connect() not interrupted by sigalrm?
- References: <200302241757.h1OHvQN16044@head-cfa.cfa.harvard.edu>
> I have an application that calls alarm() before connect() in order to
> prevent connect() from hanging if the host is down or non-existent.
> When alarm() goes off, it sends the SIGALRM signal, which interrupts
> the connect() system call. This works under Linux, Solaris, OSF, and
> Mac OS X, but apparently not under Cygwin. As shown in the appended
> code, the alarm does go off and can trigger an associated alarm
> function, but the connect() system call is not interrupted.
Cockpit error. You left out a few headers.
--- connect_test.c.orig 2003-02-24 18:25:34.000000000 +0000
+++ connect_test.c 2003-02-24 18:18:42.000000000 +0000
@@ -7,8 +7,11 @@
/* the domain exists but not the machine */
- string.h is needed for memset()
- unistd.h is needed for alarm()
- arpa/inet.h is needed for inet_addr()
After that it works fine.
elfyn at exposure dot org dot uk
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html