为了回答以上问题,写了下面测试程序 #include <pthread.h> #include <iostream> #include <signal.h> #include <stdio.h> #include <unistd.h> static void * thread_routine(void *); static void sighandler(int); int main() { int ret; struct sigaction sa={0}; sa.sa_handler = sighandler; ret = sigaction(SIGSEGV,&sa,NULL); if(ret != 0 ) { perror("FAILED to set signal action"); } pthread_t thread_id; pthread_create(&thread_id,NULL,thread_routine,NULL); for(int i = 0;i != 200;++i) { using namespace std; sleep(1); cerr<<"i is "<<i<<endl; } } void * thread_routine(void *) { int * i = 0; *i = 0; } static char mess[]="still inside/n"; void sighandler(int) { long long num = 0; for(;num != 0x7fffffffffffffffL;++num) { write(2,mess,sizeof(mess)); sleep(1); } } 发现主线程和线程是交替输出的。因此其它线程没有被挂起。