Cygwin 1.7: signal handler not invoked (regression from 1.5)

Hi there,
the following shows a problem in Cygwin 1.7 that is not present in Cygwin 1.5:
roberto@sissi /tmp $ cat bug.c #include <sys/time.h> #include <time.h> #include <signal.h> #include <stdio.h>
volatile int alarm_called = 0;
void alarm(int sig) { alarm_called = 1; }
int main() { unsigned long i; struct itimerval it;
it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 0;
/* 100,000 microseconds. */ it.it_value = (struct timeval) { 0, 100000 }; signal(SIGALRM, alarm);
setitimer(ITIMER_REAL, &it, (struct itimerval *) 0);
for (i = 0; i <= 2000000000; ++i) if (alarm_called) break;
if (alarm_called) printf("alarm() called\n"); else printf("alarm() NOT called\n");
return 0; }
roberto@sissi /tmp $ gcc -v Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug Thread model: posix gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
roberto@sissi /tmp $ gcc bug.c
roberto@sissi /tmp $ time ./a.exe alarm() NOT called
real 0m7.203s user 0m7.201s sys 0m0.015s
roberto@sissi /tmp $
As you see, the alarm() function is not invoked as it should (and as it is in Cygwin 1.5). All the best,
Roberto

On Mon, Oct 06, 2008 at 09:00:33PM +0200, Roberto Bagnara wrote:
the following shows a problem in Cygwin 1.7 that is not present in Cygwin 1.5:
[snip]
As you see, the alarm() function is not invoked as it should (and as it is in Cygwin 1.5).
It was invoked ony by coincidence in 1.5. It should be fixed in the next snapshot.
Thanks for the test case.
cgf

Christopher Faylor wrote:
On Mon, Oct 06, 2008 at 09:00:33PM +0200, Roberto Bagnara wrote:
the following shows a problem in Cygwin 1.7 that is not present in Cygwin 1.5:
[snip]
As you see, the alarm() function is not invoked as it should (and as it is in Cygwin 1.5).
It was invoked ony by coincidence in 1.5. It should be fixed in the next snapshot.
Thanks for the test case.
Dear Christopher,
Abramo Bagnara and myself have independently downloaded http://cygwin.com/snapshots/cygwin-inst-20081007.tar.bz2, unpacked it over the root directory of two separate cygwin-1.7 installations, recompiled the testcase, launched it, and alarm() is still not called.
Perhaps http://cygwin.com/snapshots/cygwin-inst-20081007.tar.bz2 is not what you meant by "the next snapshot"? Thanks for your assistance. All the best,
Roberto
participants (2)
-
Christopher Faylor
-
Roberto Bagnara