delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/27/17:09:54

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A22DB61.25D2CECB@sattel.com>
Date: Mon, 27 Nov 2000 14:08:33 -0800
From: Bruce Edge <bedge AT sattel DOT com>
Organization: Sattel Global Networks
X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.15-4mdk i686)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin support <cygwin AT sources DOT redhat DOT com>
Subject: 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019