首先,在该线程添加线程信号处理函数
void handle(int sig, siginfo_t *siginfo, void* u)
{
printf("phread exit........................\n");
pthread_exit(NULL);
}
struct sigaction sigact;
sigact.sa_handler = handle;
sigact.sa_flags = SA_SIGINFO;
sigemptyset(&sigact.sa_mask);
sigaction(SIGUSR2,&sigact,NULL);
pthread_kill(thread_id,SIGUSR2);