From: rcrampton AT armature DOT com (Robin Crampton) Subject: SIGINT pending no matter what! 24 Jun 1998 21:11:11 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit To: gnu-win32 AT cygnus DOT com The program below produces the following output: $ ./a Interrupt! Done. $ pending_signals is set to 4 (reading the sigismember() sources and sys/signal.h, this is SIGINT) whether I touch the keyboard or not. It works as expected on SunOS 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-Enterprise Huh? (B19 + coolview + EGCS 1.0.2 + binary mounts). (BTW, clock() is returning rubbish, so I'm using GetTickCount() for now) #include #include #include #include static void init_signal_handling (void); static void error (const char * s) { fprintf (stderr, s); exit (1); } int main () { int i; sigset_t pending_signals; init_signal_handling (); for (i = 5; i--; ) { if (sigpending (&pending_signals) != 0) error ("cannot determine pending signals\n"); if (sigismember (&pending_signals, SIGINT)) { printf ("Interrupt!\n"); break; } printf ("%d\n", i); sleep (1); } printf ("Done.\n"); exit (0); } static void init_signal_handling (void) { struct sigaction action; if (sigaction (SIGINT, NULL, &action) != 0) error ("cannot determine disposition of signal SIGINT\n"); if (action.sa_handler != SIG_IGN) { sigset_t mask; sigemptyset (&mask); sigaddset (&mask, SIGINT); if (sigprocmask (SIG_BLOCK, &mask, NULL) != 0) error ("cannot block signal SIGINT\n"); } } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".