Re: Managing SIGINT/UP

From: Sean Mountcastle (mtcastle@liii.com)
Date: 09/22/95


Con,

	If your autorun script doesn't get killed/interrupted too then 
the mud should come back up after it sleeps for 40.

	But in the game loop or main you can catch or trap the signals 
before they bring down the mud.  But then again if you so this I don't 
know how you'll be able to kill the process.  But here's how:


You need to include <signal.h> if it isn't already.

	Then use the function signal().

 signal(<signal type>, <what you want to do with it>)

Thus you would prolly want:
signal(SIGINT, SIG_IGN); this will ignore the interrupt signal.  Or you 
can send the signal to another function to take care of it.

extern int sighandler();

signal(SIGINT, sighandler);


Basically, you can set SIG_DFL to let the signal act 'normally' (i.e 
bring down your program), or SIG_IGN so that your program will ignore 
this signal, or send it to a function which can deal with it.  Try man 
signal, sigvec, sigblock, sigpause, sigsetmask, and sigstack to get more 
info on this.  Also I *believe* that SillyMUD has some signal handling 
routines to let it finish up and shutdown gracefully.

	- Sean

Glasgian @ The Dominion



This archive was generated by hypermail 2b30 : 12/07/00 PST