#define _GNU_SOURCE #include #include #include #include #include #include #define NUM_THREADS 2 #define MAX_TEXT 256 #define gettid() syscall(SYS_gettid) pthread_t threads[NUM_THREADS]; void * start_routine (void * kuka) { char txt[MAX_TEXT]; int l; while(1) { l=snprintf(txt,MAX_TEXT,"I am tid:%d pid:%d \n", gettid(),getpid()); while (l!=write(0,txt,l)) {} sleep(1); } } int main(int argv , char *argc[]) { char txt[MAX_TEXT]; int i; printf("I am the thread group leader, my tid:%d, pid :%d \n" "kill me, or one of my child by SIGSTOP (SIGCONT to resume)\n",gettid(),getpid()); for (i=0;i