in signal header there was a signal and raise. Signal is used to capture the signal and the raise is used to sending signal to the caller parameter.
But in multithread programming that used the pthread, we can use pthread_kill to be able to sending signal to other thread, but how to receive signal that have been send through the pthread_kill call
In any of the ways that a signal can be handled generally.
pthread_kill()differs fromkill()andraise()primarily in how the thread that will handle the signal is chosen. Withpthread_kill(), the caller designates the thread (of the same process) to which the signal will be directed. Withkill(), the caller chooses the process(es), but the system chooses which thread. Withraise(), the signal will be directed to the thread that calledraise(). None of that changes how the signal can or will be handled upon receipt by the chosen thread.When a signal becomes pending on a given thread it will be handled either
sigwait()orsigwaitinfo(), for example; ORsignal()or, better,sigaction(), ORNote well that signal handler registrations are process-wide. There are various ways to influence which threads receive which signals, but you cannot configure different threads of the same process with different handlers for the same signal.