This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Catching SIGINT problem


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 cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]