Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>gsignal() software signals</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 gsignal()               Software Signals

 #include   <signal.h>

 int        gsignal(sig);
 int        sig;                         Type of signal

    gsignal() carries out software signalling by raising the signal
    specified by 'sig' (an integer between 1 and 15) and then executing
    the action routine associated with that signal; the action routine
    must have been previously defined by using ssignal().

       Returns:     One of the following values, which are returned by
                    actions assigned to 'sig':

                          ACTION              RETURN

                          SIG_IGN                1
                          SIG_DFL                0
                          Illegal value or       0
                          no action specified

                    gsignal() returns one of the preceding values, but
                    takes no other action.

   -------------------------------- Example ---------------------------------

    The following statements set up two software signals and call them.

           #include <signal.h>  /* for gsignal, ssignal and SIG_IGN */

           #define ACTION1 1    /* uses software signal #1 */
           #define ACTION2 6    /* uses software signal #6 */

           int action1a()
           {
               return(100);
           }

           int action1b()
           {
               return(150);
           }

           int action2()
           {
               return(200);
           }

           main()
           {
               int sigval;

               ssignal(ACTION1,action1a);
               sigval = gsignal(ACTION1);    /* sigval = 100 */
               ssignal(ACTION2,action2);
               sigval = gsignal(ACTION2);    /* sigval = 200 */
               ssignal(ACTION1,action1b);
               sigval = gsignal(ACTION1);    /* sigval = 150 */
               ssignal(ACTION2,SIG_IGN);
               sigval = gsignal(ACTION2);    /* sigval = 1 */
           }


See Also: ssignal()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson