You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2003/12/29 16:06:38 UTC

cvs commit: apr/locks/unix thread_cond.c

jorton      2003/12/29 07:06:38

  Modified:    include/arch/unix apr_arch_thread_cond.h
               locks/unix thread_cond.c
  Log:
  * include/arch/unix/apr_arch_thread_cond.h: Store a pthread_cond_t
  object in struct apr_thread_cond_t rather than a pointer to one.
  
  * locks/unix/thread_cond.c (apr_thread_cond_create): Adjust use of
  ->cond, remove ENOMEM handling.  (apr_thread_cond_wait,
  apr_thread_cond_timedwait, apr_thread_cond_signal,
  apr_thread_cond_broadcast): Adjust use of ->cond.
  
  Revision  Changes    Path
  1.2       +1 -1      apr/include/arch/unix/apr_arch_thread_cond.h
  
  Index: apr_arch_thread_cond.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/apr_arch_thread_cond.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- apr_arch_thread_cond.h	6 Jan 2003 23:44:26 -0000	1.1
  +++ apr_arch_thread_cond.h	29 Dec 2003 15:06:38 -0000	1.2
  @@ -72,7 +72,7 @@
   #if APR_HAS_THREADS
   struct apr_thread_cond_t {
       apr_pool_t *pool;
  -    pthread_cond_t *cond;
  +    pthread_cond_t cond;
   };
   #endif
   
  
  
  
  1.10      +7 -18     apr/locks/unix/thread_cond.c
  
  Index: thread_cond.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/thread_cond.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -u -r1.9 -r1.10
  --- thread_cond.c	6 Jan 2003 23:44:31 -0000	1.9
  +++ thread_cond.c	29 Dec 2003 15:06:38 -0000	1.10
  @@ -64,7 +64,7 @@
       apr_thread_cond_t *cond = (apr_thread_cond_t *)data;
       apr_status_t rv;
   
  -    rv = pthread_cond_destroy(cond->cond);
  +    rv = pthread_cond_destroy(&cond->cond);
   #ifdef PTHREAD_SETS_ERRNO
       if (rv) {
           rv = errno;
  @@ -79,22 +79,11 @@
       apr_thread_cond_t *new_cond;
       apr_status_t rv;
   
  -    new_cond = (apr_thread_cond_t *)apr_pcalloc(pool,
  -                                                sizeof(apr_thread_cond_t));
  -
  -    if (new_cond == NULL) {
  -        return APR_ENOMEM;
  -    }
  +    new_cond = apr_palloc(pool, sizeof(apr_thread_cond_t));
   
       new_cond->pool = pool;
  -    new_cond->cond = (pthread_cond_t *)apr_palloc(pool, 
  -                                                  sizeof(pthread_cond_t));
  -
  -    if (new_cond->cond == NULL) {
  -        return APR_ENOMEM;
  -    }
   
  -    if ((rv = pthread_cond_init(new_cond->cond, NULL))) {
  +    if ((rv = pthread_cond_init(&new_cond->cond, NULL))) {
   #ifdef PTHREAD_SETS_ERRNO
           rv = errno;
   #endif
  @@ -115,7 +104,7 @@
   {
       apr_status_t rv;
   
  -    rv = pthread_cond_wait(cond->cond, &mutex->mutex);
  +    rv = pthread_cond_wait(&cond->cond, &mutex->mutex);
   #ifdef PTHREAD_SETS_ERRNO
       if (rv) {
           rv = errno;
  @@ -136,7 +125,7 @@
       abstime.tv_sec = apr_time_sec(then);
       abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
   
  -    rv = pthread_cond_timedwait(cond->cond, &mutex->mutex, &abstime);
  +    rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime);
   #ifdef PTHREAD_SETS_ERRNO
       if (rv) {
           rv = errno;
  @@ -153,7 +142,7 @@
   {
       apr_status_t rv;
   
  -    rv = pthread_cond_signal(cond->cond);
  +    rv = pthread_cond_signal(&cond->cond);
   #ifdef PTHREAD_SETS_ERRNO
       if (rv) {
           rv = errno;
  @@ -166,7 +155,7 @@
   {
       apr_status_t rv;
   
  -    rv = pthread_cond_broadcast(cond->cond);
  +    rv = pthread_cond_broadcast(&cond->cond);
   #ifdef PTHREAD_SETS_ERRNO
       if (rv) {
           rv = errno;