5

Will a thread stop if I send it SIGTSTP signal? Or in other words will it behave like process on SIGTSTP and SIGCONT?

Thanks in advance.

aisbaa
  • 9,867
  • 6
  • 33
  • 48

1 Answers1

4

From `man 3p pthread_kill:

Note that pthread_kill() only causes the signal to be handled in the context of the given thread; the signal action (termination or stopping) affects the process as a whole.

So I'd say that you will stop the whole process, not just the thread.

rodrigo
  • 94,151
  • 12
  • 143
  • 190
  • okay, thats possible, since I cant find sigaction for pthreads. I'll do the test. – aisbaa Jun 15 '12 at 08:23
  • read man 3p pthread_kill myself, it is obvious that I cant use pthread_kill to stop thread execution, its mainly for redirecting received signal. – aisbaa Jun 15 '12 at 08:37
  • @rodrigo I think you miss-interprited the doc here. I disagree. It will affect only the servant threads created by the main thread of the process. When it says it will affect the process , it is saying that the resource would be re-adjusted to the remaining threads in that process. – Jay D Jun 15 '12 at 08:39
  • @JayD - I disaggree with your disagreement. The doc makes a distintion between the signal _handling_ and the signal _action_. The handling, that is, the function called as a response of the signal, if any, is done by the thread; but the action, that is, terminate, coredump, stop or continue, is done by the process as a whole. (I don't see a thread coredumping, for example, while the rest of the process goes on). – rodrigo Jun 15 '12 at 09:08
  • I didn't do the test, but it feels like this is correct answer. Latter I might do the test. – aisbaa Jun 17 '12 at 10:54