Calling the signal()
function in a multithreaded program is undefined behavior , according to the C Standard. (See also undefined behavior 135 of Annex J.)
This rule is a specific instance of SIG02-C. Avoid using signals to implement normal functionality.
...