[haiku-bugs] [Haiku] #6315: [pthread] Unkillable thread

  • From: "Adek336" <trac@xxxxxxxxxxxx>
  • Date: Tue, 13 Jul 2010 22:07:32 -0000

#6315: [pthread] Unkillable thread
-------------------------+--------------------------------------------------
   Reporter:  Adek336    |        Owner:  nobody   
       Type:  bug        |       Status:  new      
   Priority:  normal     |    Milestone:  R1       
  Component:  - General  |      Version:  R1/alpha2
   Keywords:             |   Blocked By:           
Has a Patch:  0          |     Platform:  All      
   Blocking:             |  
-------------------------+--------------------------------------------------
 After reducing the testcase a lot, I ended up with

 {{{
 #include <iostream>
 #include <pthread.h>
 #include <stdlib.h>
 #include <unistd.h>

 pthread_cond_t ptcond;
 pthread_mutex_t *ptmux;

 void* fun(void*)
 {
     pthread_mutex_lock(ptmux);

     while (true)
         pthread_cond_wait(&ptcond,ptmux);
     for(;;) sleep(1000);
 }

 int
 main(int argc, char *argv[])
 {
     pthread_mutex_t ptm;
     pthread_mutex_init(&ptm,__null);
     pthread_cond_init(&ptcond,__null);
     ptmux = &ptm;
     pthread_t pt;
     pthread_create(&pt, 0, fun, 0);
     for(;;) sleep(100);
 }
 }}}

 The main thread for this process is unkillable. Interestingly, sending
 SIGTERM, SIGINT or SIGKILL to the other thread kills the process.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6315>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: