Server Wait On Clients System - API Documentation  v1.6.4
Server Wait On Clients System.
signalhandle.h File Reference

Header file for signal handling. More...

#include <libmgec/mge-portability.h>
Include dependency graph for signalhandle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

BEGIN_C_DECLS void init_sig_handle (void)
 Initialise signal handler. More...
 
void termination_handler (int signum)
 Handler for caught signals. More...
 

Detailed Description

Header file for signal handling.

Author
Copyright (C) 2015-2022 Mark Grant

Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only

Version
v1.0.11 ==== 17/09/2022

Function Documentation

◆ init_sig_handle()

BEGIN_C_DECLS void init_sig_handle ( void  )

Initialise signal handler.

Block all other caught signals whilst the handler processes.

◆ termination_handler()

void termination_handler ( int  signum)

Handler for caught signals.

There are 2 possibilities here:-
Catch, process and terminate
or
Catch, process and continue.

Catch, process and terminate is straight forward as the easiest way to terminate is to re-raise the signal using the default hander.

Catch, process and continue has 2 forms:-
Continue via simple return
or
Continue via re-raise the signal using the default handler.

The simple return is just that.

Re-raise the signal using the default handler is required for instance with SIGTSTP (Ctrl-Z). This is because in a terminal the default handler ensures the stopped process is in the background and control is passed back to the shell, (fg can then be used to resume the process). This means that SIGTSTP is now set to use the default handler, hence this relies on SIGCONT to explicitly reset the SIGTSTP handler.

Parameters
signumThe signal number.