title: What makes a pthread defunct?
body: <p>i'm working with a multi-threaded program (using pthreads) that currently create a background thread (PTHREAD_DETACHED) and then invokes pthread_exit(0). My problem is that the process is then listed as "defunct" and curiously do not seems to "really exists" in /proc (which defeats my debugging strategies)</p>
  
  <p>I would like the following requirements to be met:</p>
  
  <ul>
  <li>the program should run function A in a loop and function B once</li>
  <li>given the PID of the program /proc/$pid/exe, /proc/$pid/maps and /proc/$pid/fd must be accessible (when the process is defunct, they are all empty or invalid links)</li>
  <li>it must be possible to suspend/interrupt the program with CTRL+C and CTRL+Z as usual</li>
  </ul>
  
  <p><em>edit:</em> I hesitate changing the program's interface for having A in the "main" thread and B in a spawned thread (they are currently in the other way). Would it solve the problem ?</p>