In PR_JoinThread, we need to call pthread_detach after pthread_join
authorwtc%netscape.com
Thu, 10 Dec 1998 19:58:23 +0000
changeset 366 b0591464806bda564d8d7684df9f6f5b8061d505
parent 365 5f5db737d3ece7c198190059cff49d2a77f4ae3f
child 367 c8f725042307cde0dca715b212389ba879f2759f
push idunknown
push userunknown
push dateunknown
In PR_JoinThread, we need to call pthread_detach after pthread_join under DCE threads because DCE threads' pthread_detach does not reclaim the terminated thread's resources.
pr/src/pthreads/ptthread.c
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -473,16 +473,20 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRT
     }
     else
     {
         pthread_t id = thred->id;
         rv = pthread_join(id, &result);
         PR_ASSERT(rv == 0 && result == NULL);
         if (0 == rv)
         {
+#ifdef _PR_DCETHREADS
+            rv = pthread_detach(&id);
+            PR_ASSERT(0 == rv);
+#endif
             _pt_thread_death(thred);
         }
         else
         {
             PRErrorCode prerror;
             switch (rv)
             {
                 case EINVAL:  /* not a joinable thread */