title: Pthread threads and signals
body: <p>I am using pthread library under Linux for creating threads and I have two questions about signal handling in such applications.</p>
  
  <p>I know that signal handlers are process-wide, which means that if I set handler in process every thread will have this signal handler, also I know that there is <code>pthread_kill</code> function for sending signals to particular threads.</p>
  
  <p>I have a question about sending signals using for example shell <code>kill</code> command, as far as I understand, if I type for example <code>kill -INT PID</code> I will send <code>SIGINT</code> to process with this <code>PID</code>, if this is multithreaded program the signal will be delivered to one of the threads in this process. </p>
  
  <p>First question, I won't have any guarantee to which of the threads this signal will be delivered, I can only be sure that it will be delivered to one thread without this signal in signal mask?</p>
  
  <p>If so what about few signals that are delivered to particular thread, like 'SIGFPE', 'SIGSEGV', if I will send them using <code>kill</code> shell command they will be delivered to random thread or will they be delivered to the thread that created other threads?</p>