apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: apr/test testthread.c
Date Thu, 27 Dec 2001 17:03:00 GMT
aaron       01/12/27 09:03:00

  Modified:    include  apr_thread_proc.h
               include/arch/netware threadproc.h
               include/arch/os2 threadproc.h
               include/arch/unix threadproc.h
               include/arch/win32 threadproc.h
               threadproc/beos thread.c
               threadproc/netware thread.c
               threadproc/os2 thread.c
               threadproc/unix thread.c
               threadproc/win32 thread.c
               test     testthread.c
  Log:
  Convert apr_thread_exit(..., apr_status_t *retval) to
  apr_thread_exit(..., apr_status_t retval) so that status values
  can actually be returned back to apr_thread_join.
  
  This patch converts all platforms to store the returned status
  in the platform-specific opaque thread structure.
  
  Revision  Changes    Path
  1.78      +1 -1      apr/include/apr_thread_proc.h
  
  Index: apr_thread_proc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- apr_thread_proc.h	2001/11/27 22:10:31	1.77
  +++ apr_thread_proc.h	2001/12/27 17:02:59	1.78
  @@ -227,7 +227,7 @@
    * @param retval The return value to pass back to any thread that cares
    */
   APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, 
  -                                          apr_status_t *retval);
  +                                          apr_status_t retval);
   
   /**
    * block until the desired thread stops executing.
  
  
  
  1.4       +1 -0      apr/include/arch/netware/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/netware/threadproc.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- threadproc.h	2001/10/05 16:56:21	1.3
  +++ threadproc.h	2001/12/27 17:03:00	1.4
  @@ -72,6 +72,7 @@
       apr_int32_t cancel_how;
       void *data;
       apr_thread_start_t func;
  +    apr_status_t exitval;
   };
   
   struct apr_threadattr_t {
  
  
  
  1.13      +1 -1      apr/include/arch/os2/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/os2/threadproc.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- threadproc.h	2001/09/02 05:44:43	1.12
  +++ threadproc.h	2001/12/27 17:03:00	1.13
  @@ -74,7 +74,7 @@
       unsigned long tid;
       apr_thread_start_t func;
       void *data;
  -    apr_status_t rv;
  +    apr_status_t exitval;
   };
   
   struct apr_threadkey_t {
  
  
  
  1.21      +1 -0      apr/include/arch/unix/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/threadproc.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- threadproc.h	2001/08/27 03:17:15	1.20
  +++ threadproc.h	2001/12/27 17:03:00	1.21
  @@ -92,6 +92,7 @@
       pthread_t *td;
       void *data;
       apr_thread_start_t func;
  +    apr_status_t exitval;
   };
   
   struct apr_threadattr_t {
  
  
  
  1.17      +1 -0      apr/include/arch/win32/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/threadproc.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- threadproc.h	2001/09/09 06:03:05	1.16
  +++ threadproc.h	2001/12/27 17:03:00	1.17
  @@ -68,6 +68,7 @@
       apr_int32_t cancel_how;
       void *data;
       apr_thread_start_t func;
  +    apr_status_t exitval;
   };
   
   struct apr_threadattr_t {
  
  
  
  1.30      +2 -2      apr/threadproc/beos/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- thread.c	2001/10/29 17:29:32	1.29
  +++ thread.c	2001/12/27 17:03:00	1.30
  @@ -142,10 +142,10 @@
       return tid1 == tid2;
   }
   
  -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
  +APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
   {
       apr_pool_destroy(thd->cntxt);
  -    thd->exitval = *retval;
  +    thd->exitval = retval;
       exit_thread ((status_t)(*retval));
       /* This will never be reached... */
       return APR_SUCCESS;
  
  
  
  1.9       +5 -3      apr/threadproc/netware/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/netware/thread.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- thread.c	2001/12/11 19:40:50	1.8
  +++ thread.c	2001/12/27 17:03:00	1.9
  @@ -182,10 +182,11 @@
   }
   
   apr_status_t apr_thread_exit(apr_thread_t *thd,
  -                                          apr_status_t *retval)
  +                             apr_status_t retval)
   {
  +    thd->exitval = retval;
       apr_pool_destroy(thd->cntxt);
  -    NXThreadExit((void *)*retval);
  +    NXThreadExit(NULL);
       return APR_SUCCESS;
   }
   
  @@ -195,7 +196,8 @@
       apr_status_t  stat;    
       NXThreadId_t dthr;
   
  -    if ((stat = NXThreadJoin(thd->td, &dthr, (void *)&retval)) == 0) {
  +    if ((stat = NXThreadJoin(thd->td, &dthr, NULL)) == 0) {
  +        *retval = thd->exitval;
           return APR_SUCCESS;
       }
       else {
  
  
  
  1.30      +3 -3      apr/threadproc/os2/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/os2/thread.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- thread.c	2001/09/02 05:34:55	1.29
  +++ thread.c	2001/12/27 17:03:00	1.30
  @@ -154,9 +154,9 @@
   
   
   
  -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
  +APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
   {
  -    thd->rv = *retval;
  +    thd->exitval = retval;
       _endthread();
       return -1; /* If we get here something's wrong */
   }
  @@ -176,7 +176,7 @@
       if (rc == ERROR_INVALID_THREADID)
           rc = 0; /* Thread had already terminated */
   
  -    *retval = (apr_status_t)thd->rv;
  +    *retval = thd->exitval;
       return APR_OS2_STATUS(rc);
   }
   
  
  
  
  1.49      +4 -3      apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/thread.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- thread.c	2001/09/02 03:44:37	1.48
  +++ thread.c	2001/12/27 17:03:00	1.49
  @@ -176,10 +176,11 @@
       return pthread_equal(tid1, tid2);
   }
   
  -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
  +APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
   {
  +    thd->exitval = retval;
       apr_pool_destroy(thd->cntxt);
  -    pthread_exit(retval);
  +    pthread_exit(NULL);
       return APR_SUCCESS;
   }
   
  @@ -189,7 +190,7 @@
       apr_status_t *thread_stat;
   
       if ((stat = pthread_join(*thd->td,(void *)&thread_stat)) == 0) {
  -        *retval = thread_stat ? *thread_stat : APR_SUCCESS;
  +        *retval = thd->exitval;
           return APR_SUCCESS;
       }
       else {
  
  
  
  1.41      +5 -6      apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/thread.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- thread.c	2001/11/27 02:32:37	1.40
  +++ thread.c	2001/12/27 17:03:00	1.41
  @@ -140,10 +140,11 @@
   }
   
   APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
  -                                          apr_status_t *retval)
  +                                          apr_status_t retval)
   {
  +    thd->exitval = retval;
       apr_pool_destroy(thd->cntxt);
  -    _endthreadex(*retval);
  +    _endthreadex(0);
   	return APR_SUCCESS;
   }
   
  @@ -153,10 +154,8 @@
       apr_status_t stat;
   
       if ((stat = WaitForSingleObject(thd->td, INFINITE)) == WAIT_OBJECT_0) {
  -        if (GetExitCodeThread(thd->td, retval) == 0) {
  -            return APR_SUCCESS;
  -        }
  -        return apr_get_os_error();
  +        *retval = thd->exitval;
  +        return APR_SUCCESS;
       }
       else {
           return stat;
  
  
  
  1.26      +1 -1      apr/test/testthread.c
  
  Index: testthread.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testthread.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- testthread.c	2001/10/29 17:37:12	1.25
  +++ testthread.c	2001/12/27 17:03:00	1.26
  @@ -102,7 +102,7 @@
           x++;
           apr_lock_release(thread_lock);
       }
  -    apr_thread_exit(thd, &exit_ret_val);
  +    apr_thread_exit(thd, exit_ret_val);
       return NULL;
   } 
   
  
  
  

Mime
View raw message