Home:ALL Converter>How does a program handle an interruption with several threads and signals?

How does a program handle an interruption with several threads and signals?

Ask Time:2020-11-22T01:53:14         Author:user157629

Json Formatter

Imagine I have a program with a main function that creates several threads. In each thread I redirect the CTRL + C interruption (SIGINT) to a functionA via signal(SIGINT, functionA) and in the main process I redirect the same interruption to a functionB (signal(SIGINT, functionB).

When the program is running and the interruption SIGINT is sent, what will the program do? It will execute functionA in all threads then functionB in the main process?

Author:user157629,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/64946267/how-does-a-program-handle-an-interruption-with-several-threads-and-signals
yy