Good day everyone! Gentlemen, professionals, please resolve my doubts: a multi-threaded program receives SIGCHLD signals from the generated processes, and I would like their processing to be performed in the main execution thread, and not in the child ones. The literature stipulates that the signal is delivered to one arbitrary thread, while at the same time there is a pthread_sigmask() function that can block the delivery of a signal to a specific thread. Can I, by setting a lock for a given signal in the child streams, ensure that only the main thread performs the processing, or will this cause a loss of incoming signals?



    1 answer 1

    Yes you can. That is the way to do it.

    The signal handler is called on an arbitrary "unlocked" thread.

    • @avp, thanks! - margosh