Home
 
 
Search:  
C C++ Perl PHP Python HTML ShellScripts
 
 
  Coding Books
  Tutorials
  Search Code
  Browse Code
  Link to Us
  Site News
  Contact Metalshell
 
 
 
  Submit Code   Statistics
 



Gcc Target Description Macros: Using and Porting the Gnu Compiler Collection Gcc    (ISBN: 0595100384)


 

 List Price: $14.95
 Our Price: $14.95
 Used Price:

 Release Date: August, 1900
 Manufacturer: iUniverse.com (Paperback)
 Sales Rank: 535,117

 Author: Richard M. Stallman









More Info

 Catch Signal 2003-05-01 22:01:27
 
Category: source:c:linux
Description: This program contains a signal handler so uninterruptable with Ctrl+C keys.
Platform: unix
Author: pipas
Viewed: 6206
Rating: 4.3/5 (78 votes)
If you have any questions about this piece of code or still need help, try posting your question on the forum.

 

Printable Version
signal.c
/*
 * Example program by pipas@linux.pte.hu
 * This program is uninterruptable  with
 * Ctrl+C, uses signal handler
 *
 * http://www.metalshell.com/
 */

#include <stdio.h>
#include <signal.h>
#include <unistd.h>

/* The signal handler function */
void handler( int signal ) {
  printf("Signal handler...\n");
  psignal( signal, "Signal: ");
}  /*handler*/

main() {
  /* Registering the handler, catching
     SIGINT signals */
  signal( SIGINT, handler );

  /* Do nothing */
  while( 1 ) {
    printf("Running...\n");
    sleep(10);
  }  /*while*/
}  /*main*/
Rate this code:
(Not Helpful)  (Very Helpful) 

 
 
   Developer.*  
   Blue Parrots  
   Technipal  
   Defy Magazine  
   Code Project  
   Prog. Heaven  


Got Money?