From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Vignal To: gdb@sources.redhat.com Subject: thread cannot stop himself Date: Thu, 08 Feb 2001 05:58:00 -0000 Message-id: <01020814582000.18700@nicolas> X-SW-Source: 2001-02/msg00079.html Hello I join a sample program with a thread who try to stop himself with a SIGSTOP. ( I know that is not the best way to do that ;-) It works fine in command line but not under gdb. gdb receive the signal and the flag pass to program is yes. But the thread never stop. Any idea of what happened ? Regards Nicolas I'am using a Linux RedHat 6.2 with insight 20010202 #include #include #include int function(void) { printf("I want to stop this thread\n"); pthread_kill(pthread_self(), SIGSTOP); while(1){ printf("Why it's not working ?\n"); } } int main(int argc, char *argv[]) { pthread_t threadID=-1; pthread_create(&threadID, NULL, function, NULL); while(1); return 0; } (gdb) run Starting program: /home/tsc/essai/stopthread [New Thread 1024 (runnable)] [New Thread 2049 (runnable)] [New Thread 1026 (runnable)] Program received signal SIGSTOP, Stopped (signal). [Switching to Thread 1026 (runnable)] 0x4004dd41 in __kill () from /lib/libc.so.6 (gdb) handle SIGSTOP Signal Stop Print Pass to program Description SIGSTOP Yes Yes Yes Stopped (signal) (gdb) c Continuing. After I can see "Why it's not working ?" in loop