Answer the question
In order to leave comments, you need to log in
How to install custom SIGUSR1 and SIGUSR2 signal handler?
By default, the user signals SIGUSR1 and SIGUSR2 terminate a process or thread. How to make it so that they install their own handler? I tried to read various articles on this topic, but since I'm new to this topic, I couldn't transfer it for my needs.
And the need for the following is a number of producer threads (pthread) that execute a number of instructions in a cycle and at the end of each iteration wait for a SIGURS1 signal (sigwait) from the main consumer thread, and only after receiving the signal go to the next iteration. But due to default termination, they are therefore terminated.
Those. all that is needed here is the very fact of receiving these signals to move on to the next iteration, and they complete the process.
Answer the question
In order to leave comments, you need to log in
man signal
#include <signal.h>
void sigprocess (int sign){
/* process signal here */
}
...
int main(){
...
signal (SIGUSR1, sigprocess);
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question