title: After main thread call pthread_exit, it turn into zombie.something wrong?
body: <p>I want to enumerate threads of specific process using /proc/[pid]/task/.but in proc man pages, it said:</p>
  
  <blockquote>
    <p>In a multithreaded process, the contents of the /proc/[pid]/task directory are not available if the main thread has already terminated (typically by calling pthread_exit(3)).</p>
  </blockquote>
  
  <p>then I write some code,</p>
  
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  
  void* PrintHello(void* data){
    pthread_t tid = (pthread_t)data;
    int rc;
  
    rc = pthread_join(tid, NULL);
    if(rc){
      exit(1);
    } else{
      printf("Hello from new thread %d - got %d\n", pthread_self(), data);
      sleep(180);
      pthread_exit(NULL);
    }
  }
  
  int main(int argc, char* argv[]){
    int rc;
    pthread_t thread_id;
    thread_t tid;
  
    tid = pthread_self();
    printf("\nmain thread(%d) ", tid); 
  
    rc = pthread_create(&amp;thread_id, NULL, PrintHello, (void*)tid);
    if(rc){
      printf("\n ERROR: return code from pthread_create is %d \n", rc);
      exit(1);
    }
    sleep(1);
    printf("\n Created new thread (%d) ... \n", thread_id);
    pthread_exit(NULL);
  }
  </code></pre>
  
  <p>after the main thread call pthread_exit(), it turn to zombie. and the /proc/[pid]/task directory remains, but /proc/[pid]/maps is empty.</p>
  
  <pre><code>$ ./a.out &amp; 
   main thread(164759360) 
   Created new thread (164755200) ... 
  Hello from new thread 164755200 - got 164759360
  
  $ ps auwx |  grep a.out
  spyder    5408  0.0  0.0      0     0 pts/0    Zl+  10:27   0:00 [a.out] &lt;defunct&gt;
  spyder    5412  0.0  0.0 109400   896 pts/1    S+   10:27   0:00 grep --color=auto a.out
  
  $ ls /proc/5408/task/
  5408  5409
  $ cat /proc/5408/maps 
  $ cat /proc/5408/status
  Name:   a.out
  State:  Z (zombie)
  Tgid:   5408
  Pid:    5408
  ....
  $ cat /proc/5409/maps 
  00400000-00401000 r-xp 00000000 fd:02 2752690                            /home/spyder/a.out
  00600000-00601000 rw-p 00000000 fd:02 2752690                            /home/spyder/a.out
  018cb000-018ec000 rw-p 00000000 00:00 0                                  [heap]
  3dcf000000-3dcf020000 r-xp 00000000 fd:01 139203                         /usr/lib64/ld-2.15.so
  3dcf21f000-3dcf220000 r--p 0001f000 fd:01 139203                         /usr/lib64/ld-2.15.so
  ....
  </code></pre>
  
  <p>Something wrong?</p>