Home » Source Code » » CATCHSIG.C

CATCHSIG.C ( File view )

From:
  • By 2010-08-14
  • View(s):34
  • Download(s):1
  • Point(s): 1
			/*******************************************************************************
* This is the skeleton for the signal handling shutdown function - to set up   *
* signal handling for SIGUSR1, just call:                                      *
*                                                                              *
*     init_sighandler( &appl_data );                                           *
*                                                                              *
*  where "appl_data" is a buffer/struct containing data that sighandler()      *
*  can use when it is cleaning up prior to exiting - it is OK for              *
*  you to call init_sighandler() with a NULL pointer - if you do, then         *
*  "static_pappl_data" will be NULL.                                           *
*                                                                              *
*  Add whatever code you want to the sighandler() function to perform          *
*  your application-specific shudown - if you were talking over the            *
*  network (your process called msg_init()), then do NOT forget to call the    *
* "msg_delete()" function to deallocate your network resources.                *
*******************************************************************************/

#include <stdio.h>
#include <signal.h>
#include <sys/types.h>

void     sighandler();
void init_sighandler( );

/* 'static_pappl_data' is a pointer to some data you want to have available
   to sighandler() when it catches SIGUSR1 */

/******************************************************************************/

/* to catch the interrupt signal for shutdown */
void init_sighandler( )
{


/* set up sighandler() as the signal handler for SIGUSR1 */
   (void)signal( SIGUSR1, sighandler );

}

/******************************************************************************/

/* signal handler called when application catches a SIGUSR1 */
void sighandler()
{

/* this is the skeleton for the signal handler - you may do ANY kind of
   cleanup/shutdown processing you desire, just make certain that you
   exit( 0 ) when you are done... */
   msg_delete();
   exit( 0 );

}
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
源码文件 .make.state.make.state27.00 B10-03-03 13:13
code file 104DEF.H104DEF.H5.45 kB10-03-03 13:13
code file 104DRV.C104DRV.C4.23 kB10-03-03 13:13
code file 104LIB.C104LIB.C53.88 kB10-03-03 13:13
code file 104RD.C104RD.C2.21 kB10-03-03 13:13
code file 104ZRG.TXT104ZRG.TXT2.51 kB10-03-03 13:13
code file CATCHSIG.CCATCHSIG.C2.12 kB10-03-03 13:13
code file catchsig1.ccatchsig1.c348.00 B10-03-03 13:13
源码文件 DD.DB1DD.DB16.83 kB10-03-03 13:13
code file IPDEF.HIPDEF.H460.00 B10-03-03 13:13
code file MAKE.BATMAKE.BAT45.00 B10-03-03 13:13
源码文件 MAKE.SCOMAKE.SCO1.61 kB10-03-03 13:13
源码文件 MAKE.SUNMAKE.SUN1.67 kB10-03-03 13:13
源码文件 MAKE.TSTMAKE.TST1.58 kB10-03-03 13:13
源码文件 MKRD.SCOMKRD.SCO1.58 kB10-03-03 13:13
code file READMEREADME5.00 kB10-03-03 13:13
code file TEST.CTEST.C7.85 kB10-03-03 13:13
源码文件 <net104drv><net104drv>0.00 B10-07-07 16:54
...
Sponsored links
×

CATCHSIG.C (22.21 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

×

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com
×

切换到中文版?

CodeForge Chinese Version
CodeForge English Version
×

Where are you going?

×

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK
×

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D