apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/threadproc/beos thread.c
Date Mon, 29 Oct 2001 17:29:32 GMT
dreid       01/10/29 09:29:32

  Modified:    include/arch/beos threadproc.h
               threadproc/beos thread.c
  Log:
  BeOS threads can exit in strange orders, even in testthread they will often
  exit in an order different from that they were started in, so store the thread
  exitval and if we miss the death of a thread when calling thread_join we return
  the stored value.
  
  Revision  Changes    Path
  1.20      +1 -0      apr/include/arch/beos/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/beos/threadproc.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- threadproc.h	2001/09/11 13:33:39	1.19
  +++ threadproc.h	2001/10/29 17:29:32	1.20
  @@ -82,6 +82,7 @@
       thread_id td;
       void *data;
       apr_thread_start_t func;
  +    apr_status_t exitval;
   };
   
   struct apr_threadattr_t {
  
  
  
  1.29      +10 -1     apr/threadproc/beos/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- thread.c	2001/10/28 13:46:15	1.28
  +++ thread.c	2001/10/29 17:29:32	1.29
  @@ -109,6 +109,7 @@
       (*new)->cntxt = pool;
       (*new)->data = data;
       (*new)->func = func;
  +    (*new)->exitval = -1;
   
       /* First we create the new thread...*/
   	if (attr)
  @@ -144,6 +145,7 @@
   APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
   {
       apr_pool_destroy(thd->cntxt);
  +    thd->exitval = *retval;
       exit_thread ((status_t)(*retval));
       /* This will never be reached... */
       return APR_SUCCESS;
  @@ -157,7 +159,14 @@
           return APR_SUCCESS;
       }
       else {
  -        return ret;
  +        /* if we've missed the thread's death, did we set an exit value prior
  +         * to it's demise?  If we did return that.
  +         */
  +        if (thd->exitval != -1) {
  +            *retval = thd->exitval;
  +            return APR_SUCCESS;
  +        } else 
  +            return ret;
       }
   }
   
  
  
  

Mime
View raw message