Pthread: do other threads stop while the SIGSEGV handler is running?

I am developing a program on Solaris 10. I want it to print a stack trace on failure. I found this example:

static void pstack()
{
  char buf[256];

  sprintf(buf, "/usr/proc/bin/pstack %d |/bin/tee traceback.txt\n", (int)getpid());
  /* undefine LD_PRELOAD to avoid 64-bit problems */
  (void)putenv("LD_PRELOAD=");
  system(buf);
}
void sighanterm(int signo, siginfo_t *info, void *context) {
    ...
    pstack();
}

Interestingly, while /usr/proc/bin/pstackexecuted, other threads also print their output. Do threads repeat on a call system()or do they not stop at all? Can I stop them explicitly in the handler?

+3
source share
1 answer

No, the processed one SIGSEGVdoes not affect any other threads (although if it was caused by memory corruption or another UB, the UB could, of course, affect other threads). Unprocessed SIGSEGV, on the other hand, completes the whole process.

+2
source

All Articles