Index Page
gfinth_c
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   void gfinth_c ( int sigcode ) 

Abstract

   Respond to the interrupt signal SIGINT: save an indication
   that the signal has been received. This routine restores
   itself as the handler for SIGINT.
 

Required_Reading

 
   GF
 

Keywords

 
   GEOMETRY
   SEARCH
   UTILITY 
 

Brief_I/O

 
   VARIABLE  I/O  DESCRIPTION 
   --------  ---  -------------------------------------------------- 
   sigcode    I   Interrupt signal ID code.
 

Detailed_Input

 
   sigcode    is a signal code. `sigcode' is expected to be the 
              ANSI C parameter SIGINT, which represents the 
              interrupt signal.
   

Detailed_Output

 
   None.
 

Parameters

 
   None. 
 

Exceptions

 
   1) If `sigcode' is not SIGINT, the error SPICE(INVALIDSIGNAL) 
      is signaled (in the SPICE error handling sense).

   2) If the call to the ANSI C function `signal' made
      by this routine fails, the error SPICE(SIGNALFAILED)
      is signaled (via SPICE error handling).
 

Files

 
   None. 
 

Particulars

   This interrupt handler should be used by routines that 
   participate in GF interrupt handling. Such routines should
   call the ANSI C library routine `signal' with the ANSI C
   macro SIGINT and this routine as the input arguments.

   When this routine executes, it re-establishes itself as the 
   handler for the interrupt signal SIGINT. Code that uses
   CSPICE interrupt handling must restore the previous
   handler before returning.

   Once this routine is established as the handler for the
   interrupt signal SIGINT, the GF "bail out" test routine
   gfbail_c will return SPICETRUE until the interrupt status
   is cleared via a call to gfclrh_c.
 

Examples

 
   1)  Make this routine the GF signal handler, then restore
       the previous handler. This example serves only to
       demonstrate the use of signal; the example code
       performs no useful function.


       #include <signal.h>
       #include "SpiceUsr.h"

       int main()
       {
          /.
          Prototypes
          ./
          static void      ( * previousHandler )(int);
          static void      ( * handlerPtr      )(int);

          /.
          Make gfinth_c the handler for the SIGINT signal.
          ./
          previousHandler = signal ( SIGINT, gfinth_c );

          if ( previousHandler == SIG_ERR )
          {
             setmsg_c ( "Attempt to establish gfinth_c as the "
                        "handler for the SIGINT signal failed." );
             sigerr_c ( "SPICE(SIGNALFAILED)"                   );
          }

          /.
          Restore the previous handler.
          ./
          handlerPtr = signal ( SIGINT, previousHandler );

          if ( handlerPtr == SIG_ERR )
          {
             setmsg_c ( "Attempt to re-establish the previous "
                        "handler for the SIGINT signal failed." );
             sigerr_c ( "SPICE(SIGNALFAILED)"                   );
          }

          return ( 0 );

       }
 

Restrictions

 
   None.
 

Literature_References

 
   None. 
 

Author_and_Institution

 
   N.J. Bachman   (JPL) 
 

Version

 
   -CSPICE Version 1.0.0, 25-FEB-2009 (NJB)

Index_Entries

 
   GF handle interrupt signal
 

Link to routine gfinth_c source file gfinth_c.c

Wed Apr  5 17:54:35 2017