apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/threadproc/unix thread.c
Date Mon, 29 Sep 2003 12:35:32 GMT
jorton      2003/09/29 05:35:32

  Modified:    include/arch/unix apr_arch_threadproc.h
               threadproc/unix thread.c
  Log:
  * include/arch/unix/apr_arch_threadproc.h: Store a pthread_attr_t
  structure in apr_threadattr_t, rather than a pointer to one.
  
  * threadproc/unix/thread.c (apr_threadattr_create): Use a single
  palloc call, omit ENOMEM handling.  (apr_threadattr_detach_set,
  apr_threadattr_detach_get, apr_thread_create): Adjust use of ->attr
  appropriately.
  
  Revision  Changes    Path
  1.6       +1 -1      apr/include/arch/unix/apr_arch_threadproc.h
  
  Index: apr_arch_threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/apr_arch_threadproc.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- apr_arch_threadproc.h	7 Feb 2003 21:02:31 -0000	1.5
  +++ apr_arch_threadproc.h	29 Sep 2003 12:35:32 -0000	1.6
  @@ -97,7 +97,7 @@
   
   struct apr_threadattr_t {
       apr_pool_t *pool;
  -    pthread_attr_t *attr;
  +    pthread_attr_t attr;
   };
   
   struct apr_threadkey_t {
  
  
  
  1.55      +9 -13     apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/thread.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -u -r1.54 -r1.55
  --- thread.c	6 Jan 2003 23:44:38 -0000	1.54
  +++ thread.c	29 Sep 2003 12:35:32 -0000	1.55
  @@ -58,21 +58,17 @@
   
   #if APR_HAS_THREADS
   
  +/* XXX: missing a cleanup, pthread_attr_destroy is never called! */
  +
   #if APR_HAVE_PTHREAD_H
   APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
                                                   apr_pool_t *pool)
   {
       apr_status_t stat;
   
  -    (*new) = (apr_threadattr_t *)apr_pcalloc(pool, sizeof(apr_threadattr_t));
  -    (*new)->attr = (pthread_attr_t *)apr_pcalloc(pool, sizeof(pthread_attr_t));
  -
  -    if ((*new) == NULL || (*new)->attr == NULL) {
  -        return APR_ENOMEM;
  -    }
  -
  +    (*new) = apr_palloc(pool, sizeof(apr_threadattr_t));
       (*new)->pool = pool;
  -    stat = pthread_attr_init((*new)->attr);
  +    stat = pthread_attr_init(&(*new)->attr);
   
       if (stat == 0) {
           return APR_SUCCESS;
  @@ -91,9 +87,9 @@
   #ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
       int arg = on;
   
  -    if ((stat = pthread_attr_setdetachstate(attr->attr, &arg)) == 0) {
  +    if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) {
   #else
  -    if ((stat = pthread_attr_setdetachstate(attr->attr, on)) == 0) {
  +    if ((stat = pthread_attr_setdetachstate(&attr->attr, on)) == 0) {
   #endif
   
           return APR_SUCCESS;
  @@ -112,9 +108,9 @@
       int state;
   
   #ifdef PTHREAD_ATTR_GETDETACHSTATE_TAKES_ONE_ARG
  -    state = pthread_attr_getdetachstate(attr->attr);
  +    state = pthread_attr_getdetachstate(&attr->attr);
   #else
  -    pthread_attr_getdetachstate(attr->attr, &state);
  +    pthread_attr_getdetachstate(&attr->attr, &state);
   #endif
       if (state == 1)
           return APR_DETACH;
  @@ -153,7 +149,7 @@
       (*new)->func = func;
   
       if (attr)
  -        temp = attr->attr;
  +        temp = &attr->attr;
       else
           temp = NULL;
   
  
  
  

Mime
View raw message