Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

signals

Status
Not open for further replies.

stevebiks

Programmer
Feb 13, 2005
10
US
okay if im messing with processes and signals/signal handlers, and i want to dissable a the parents signal hadlers, and enable the child's signal handlers, what do i do to dissable those of the parent? thanks for any help
 
Not sure if its the best way, but I do it like this :

Code:
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>


/**
*	Catch SIGTERM term commands
*/
void term_handler(int sig) {

	printf("oooh, I've caught a SIGTERM : %d\n", sig);
  	exit(0);

}

int main(int argc, char* argv[]) {
	// catch SIGTERM (eg, kill -9 PID)
	signal(SIGTERM, term_handler);
	
	// rest of your programme

	return 0;

}

--------------------------------------------------
Free Database Connection Pooling Software
 
After your fork() use sigprocmask to reset your blocked
list and sigaction or signal to reset your handlers in the child.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top