Subject: Catching SIGINT problem
From: Bruce Edge <[email-masked]>
To: cygwin support <[email-masked]>
Date: Mon, 27 Nov 2000 14:08:33 -0800

I can't seem to trap a Ctrl-C in my app.

I use the following code to trap all signals I'm interested in:

  sigemptyset( &SignalSet );
 
  for ( int s = _SIGMIN; s < _SIGMAX; s++ ) {
    if ( ( s != SIGFPE ) &&
         ( s != SIGKILL ) &&
         ( s != SIGSTOP ) &&
         ( s != SIGCONT ) &&
         ( s != SIGTERM ) ) {
      sigaddset( &SignalSet, s );
      if ( signal( s, lcbd_SigHandler ) == SIG_ERR ) {
        syslog( LOG_CRIT, "sigaddset failed, sig %d, %s", s, strerror( errno )
);
        exit(-1);
      }
    }
 
}                                                                             

And then use the following handler:

void lcbd_SigHandler( int signo ) {
  ReceivedSignal = 1<<signo;
  // [BRE] * test
  if ( signo != 14 )
    return;
}
 
When I issue a "kill -s SIGURG" from bash, it calls my handler OK.
When I try a "kill -s SIGINT" the app terminates.

Am I missing something here?

TIA, Bruce.

--
Want to unsubscribe from this list?
Send a message to [email-masked]