Home What is the scope of signals?
Reply: 0

What is the scope of signals?

user4289
1#
user4289 Published in September 19, 2018, 3:36 am

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?

share|improve this question

1 Answer 1

active oldest votes
up vote 2 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303795 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO