httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/threadproc/unix thread.c
Date Sat, 22 Apr 2000 05:06:42 GMT
rbb         00/04/21 22:06:41

  Modified:    src/lib/apr/threadproc/unix thread.c
  Log:
  The last two commits to remove contexts, horribly breaks threads on Unix.
  This fixes all of the problems.
  
  Revision  Changes    Path
  1.19      +103 -0    apache-2.0/src/lib/apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/thread.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- thread.c	2000/04/19 21:17:40	1.18
  +++ thread.c	2000/04/22 05:06:41	1.19
  @@ -101,6 +101,109 @@
       return APR_NOTDETACH;
   }
   
  +ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, 
  +                             ap_thread_start_t func, void *data, 
  +                             ap_pool_t *cont)
  +{
  +    ap_status_t stat;
  +    pthread_attr_t *temp;
  + 
  +    (*new) = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t));
  +
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +
  +    (*new)->td = (pthread_t *)ap_palloc(cont, sizeof(pthread_t));
  +
  +    if ((*new)->td == NULL) {
  +        return APR_ENOMEM;
  +    }
  +
  +    (*new)->cntxt = cont;
  +
  +    if (attr)
  +        temp = attr->attr;
  +    else
  +        temp = NULL;
  +    
  +    stat = ap_create_pool(&(*new)->cntxt, cont);
  +    if (stat != APR_SUCCESS) {
  +        return stat;
  +    }
  +
  +    if ((stat = pthread_create((*new)->td, temp, func, data)) == 0) {
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        return stat;
  +    } 
  +}
  +
  +ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval)
  +{
  +    ap_destroy_pool(thd->cntxt);
  +    pthread_exit(retval);
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd)
  +{
  +    ap_status_t stat;
  +
  +    if ((stat = pthread_join(*thd->td,(void *)&retval)) == 0) {
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        return stat;
  +    }
  +}
  +
  +ap_status_t ap_thread_detach(ap_thread_t *thd)
  +{
  +    ap_status_t stat;
  +
  +    if ((stat = pthread_detach(*thd->td)) == 0) {
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        return stat;
  +    }
  +}
  +
  +ap_status_t ap_get_threaddata(void **data, char *key, ap_thread_t *thread)
  +{
  +    if (thread != NULL) {
  +        return ap_get_userdata(data, key, thread->cntxt);
  +    }
  +    else {
  +        data = NULL;
  +        return APR_ENOTHREAD;
  +    }
  +}
  +
  +ap_status_t ap_set_threaddata(void *data, char *key,
  +                              ap_status_t (*cleanup) (void *),
  +                              ap_thread_t *thread)
  +{
  +    if (thread != NULL) {
  +        return ap_set_userdata(data, key, cleanup, thread->cntxt);
  +    }
  +    else {
  +        data = NULL;
  +        return APR_ENOTHREAD;
  +    }
  +}
  +
  +ap_status_t ap_get_os_thread(ap_os_thread_t *thethd, ap_thread_t *thd)
  +{
  +    if (thd == NULL) {
  +        return APR_ENOTHREAD;
  +    }
  +    thethd = thd->td;
  +    return APR_SUCCESS;
  +}
  +
   ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, 
                                ap_pool_t *cont)
   {
  
  
  

Mime
View raw message