title: thread at exit cleanup
body: <p>I have an application in which I have 1 main thread which creates 10 different threads for doing some job. At the end of application, when I try to exit, the application is not able to cleanly exit. The stack trace is not that useful, but its showing the crash in function "cancel_deliver()" My first guess is this is some underlying call made while doing the freeing up of resources used by each thread, but not entirely sure. </p>
  
  <p>fyi: The callback function for each thread has a while (1) loop:</p>
  
  <p>Here is the snippet</p>
  
  <pre><code>void main (...)
  {
      pthread_t tid;
      for (int i=0; i&lt;10; i++)
          pthread_create(&amp;tid, NULL, xyzCallback,  NULL);
  }
  
  void xyzCallback(void* data)
  {
      while (1)
      {
         ////
      } 
  }
  
  void atExit()
  {
      exit(1);
  }
  </code></pre>
  
  <p>Is there any thing that I can do to free up resrouces used by my thread and cleanly exit?</p>