Home What is the scope of signals?

# What is the scope of signals?

Zeno Raiser
1#
Zeno Raiser Published in 2018-01-12 19:54:46Z
 What is the scope of a signal after I install it?? For example if I have in a function called A this code: sa.sa_handler = &handle_manager_bd; sa.sa_flags = SA_NODEFER | SA_RESTART; sigemptyset(&my_mask); sa.sa_mask = my_mask; sigaction(SIGUSR1, &sa, NULL);  If after this i call B, which is another function in the same program, that process will get the signal and do the action specified by handle_manager_bd right?? Another example which i would like to understand is as follows: if I have installed the handler in a function A like before and after that I call a function C, which is contained in a header file like "c.h" included by the program which contains A with #include "c.h", if I don't install the signal handler in the function C the signal will be recognized because i already installed it in A or should i put again the code above in the function C like i did for A?
user3386109
2#
 Signals have process scope. Once you install a handler it remains in effect until either you remove it with another call to sigaction the handler gets called and the SA_RESETHAND flag is set