Do some work on PR_JoinThread (it should work now, but tests/switch seems to be failing...) and also un #if 0 PR_ResumeAll and PR_SuspendAll. they just call PR_Resume and PR_Suspend, which are still #if 0'ed. RHAPSODY_NSPR_BRANCH
authortoshok
Tue, 05 May 1998 12:20:11 +0000
branchRHAPSODY_NSPR_BRANCH
changeset 88 6a0906eecc8aad9c05eb4705aade5b11b0a0f809
parent 87 e5d8e228958ccef054d331d73642d1a6a9295c19
child 89 ee61d81e87b483776ed7d309dec9d4693ebf6ff5
push idunknown
push userunknown
push dateunknown
Do some work on PR_JoinThread (it should work now, but tests/switch seems to be failing...) and also un #if 0 PR_ResumeAll and PR_SuspendAll. they just call PR_Resume and PR_Suspend, which are still #if 0'ed.
pr/src/cthreads/ctthread.c
--- a/pr/src/cthreads/ctthread.c
+++ b/pr/src/cthreads/ctthread.c
@@ -347,17 +347,16 @@ PR_IMPLEMENT(PRThread*) PR_AttachThread(
         PR_Unlock(ct_book.ml);
 
     }
     return thred;  /* may be NULL */
 }  /* PR_AttachThread */
 
 PR_IMPLEMENT(PRStatus) PR_JoinThread(PRThread *thred)
 {
-    int rv = -1;
     void *result = NULL;
     PR_ASSERT(thred != NULL);
 
     if ((0xafafafaf == thred->state)
     || (CT_THREAD_DETACHED & thred->state))
     {
         /*
          * This might be a bad address, but if it isn't, the state should
@@ -371,22 +370,24 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRT
 
         PR_ASSERT((0xafafafaf == thred->state)
         || (CT_THREAD_DETACHED & thred->state));
     }
     else
     {
         cthread_t id = thred->id;
         result = cthread_join(id);
+        if (NULL == result)
+            PR_SetError(PR_UNKNOWN_ERROR, errno);
     	PR_DELETE(thred->stack);
         memset(thred, 0xaf, sizeof(PRThread));
         PR_ASSERT(result == NULL);
         PR_DELETE(thred);
     }
-    return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
+    return (NULL != result) ? PR_SUCCESS : PR_FAILURE;
 }  /* PR_JoinThread */
 
 PR_IMPLEMENT(void) PR_DetachThread()
 {
     PRThread *thred;
     cthread_getspecific(ct_book.key, &thred);
     PR_ASSERT(NULL != thred);
 
@@ -929,17 +930,16 @@ PR_IMPLEMENT(void) PR_ResumeTest(PRThrea
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, (
         "End PR_ResumeTest thred %X tid %X\n", thred, thred->id));
 #endif
 }  /* PR_ResumeTest */
 
 PR_IMPLEMENT(void) PR_SuspendAll()
 {
-#if 0
 #ifdef DEBUG
     PRIntervalTime stime, etime;
 #endif
     PRThread* thred = ct_book.first;
     PRThread *me = PR_CurrentThread();
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_SuspendAll\n"));
     /*
      * Stop all threads which are marked GC able.
@@ -967,22 +967,20 @@ PR_IMPLEMENT(void) PR_SuspendAll()
 
     suspendAllSuspended = PR_TRUE;
 
 #ifdef DEBUG
     etime = PR_IntervalNow();
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,\
         ("End PR_SuspendAll (time %dms)\n", etime - stime));
 #endif
-#endif
 }  /* PR_SuspendAll */
 
 PR_IMPLEMENT(void) PR_ResumeAll()
 {
-#if 0
 #ifdef DEBUG
     PRIntervalTime stime, etime;
 #endif
     PRThread* thred = ct_book.first;
     PRThread *me = PR_CurrentThread();
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_ResumeAll\n"));
     /*
      * Resume all previously suspended GC able threads.
@@ -1018,14 +1016,13 @@ PR_IMPLEMENT(void) PR_ResumeAll()
 
 /* Return the stack pointer for the given thread- used by the GC */
 PR_IMPLEMENT(void *)PR_GetSP(PRThread *thred)
 {
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
 	    ("in PR_GetSP thred %X thid = %X, sp = %X \n", 
 	    thred, thred->id, thred->sp));
     return thred->sp;
-#endif
 }  /* PR_GetSP */
 
 #endif  /* defined(_PR_CTHREADS) */
 
-/* ptthread.c */
+/* ctthread.c */