apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/locks/unix thread_rwlock.c
Date Sat, 04 Oct 2003 11:46:24 GMT
jorton      2003/10/04 04:46:24

  Modified:    include/arch/unix apr_arch_thread_rwlock.h
               locks/unix thread_rwlock.c
  Log:
  * include/arch/unix/apr_arch_thread_rwlock.h: Store a pthread_rwlock_t
  object in struct apr_thread_rwlock_t rather than a pointer to one.
  
  * locks/unix/thread_rwlock.c (apr_thread_rwlock_create): Adjust use of
  ->rwlock, simplify to a single palloc call, and remove ENOMEM handling.
  (apr_thread_rwlock_rdlock, apr_thread_rwlock_tryrdlock,
  apr_thread_rwlock_wrlock, apr_thread_rwlock_trywrlock,
  apr_thread_rwlock_unlock): Adjust use of ->rwlock appropriately.
  
  Revision  Changes    Path
  1.2       +1 -1      apr/include/arch/unix/apr_arch_thread_rwlock.h
  
  Index: apr_arch_thread_rwlock.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/apr_arch_thread_rwlock.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- apr_arch_thread_rwlock.h	6 Jan 2003 23:44:26 -0000	1.1
  +++ apr_arch_thread_rwlock.h	4 Oct 2003 11:46:24 -0000	1.2
  @@ -71,7 +71,7 @@
   
   struct apr_thread_rwlock_t {
       apr_pool_t *pool;
  -    pthread_rwlock_t *rwlock;
  +    pthread_rwlock_t rwlock;
   };
   
   #else
  
  
  
  1.11      +8 -20     apr/locks/unix/thread_rwlock.c
  
  Index: thread_rwlock.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/thread_rwlock.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -u -r1.10 -r1.11
  --- thread_rwlock.c	3 Oct 2003 15:30:57 -0000	1.10
  +++ thread_rwlock.c	4 Oct 2003 11:46:24 -0000	1.11
  @@ -66,7 +66,7 @@
       apr_thread_rwlock_t *rwlock = (apr_thread_rwlock_t *)data;
       apr_status_t stat;
   
  -    stat = pthread_rwlock_destroy(rwlock->rwlock);
  +    stat = pthread_rwlock_destroy(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  @@ -81,22 +81,10 @@
       apr_thread_rwlock_t *new_rwlock;
       apr_status_t stat;
   
  -    new_rwlock = (apr_thread_rwlock_t *)apr_pcalloc(pool,
  -                                                  sizeof(apr_thread_rwlock_t));
  -
  -    if (new_rwlock == NULL) {
  -        return APR_ENOMEM;
  -    }
  -
  +    new_rwlock = apr_palloc(pool, sizeof(apr_thread_rwlock_t));
       new_rwlock->pool = pool;
  -    new_rwlock->rwlock = (pthread_rwlock_t *)apr_palloc(pool, 
  -                                                     sizeof(pthread_rwlock_t));
  -
  -    if (new_rwlock->rwlock == NULL) {
  -        return APR_ENOMEM;
  -    }
   
  -    if ((stat = pthread_rwlock_init(new_rwlock->rwlock, NULL))) {
  +    if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, NULL))) {
   #ifdef PTHREAD_SETS_ERRNO
           stat = errno;
   #endif
  @@ -115,7 +103,7 @@
   {
       apr_status_t stat;
   
  -    stat = pthread_rwlock_rdlock(rwlock->rwlock);
  +    stat = pthread_rwlock_rdlock(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  @@ -128,7 +116,7 @@
   {
       apr_status_t stat;
   
  -    stat = pthread_rwlock_tryrdlock(rwlock->rwlock);
  +    stat = pthread_rwlock_tryrdlock(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  @@ -144,7 +132,7 @@
   {
       apr_status_t stat;
   
  -    stat = pthread_rwlock_wrlock(rwlock->rwlock);
  +    stat = pthread_rwlock_wrlock(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  @@ -157,7 +145,7 @@
   {
       apr_status_t stat;
   
  -    stat = pthread_rwlock_trywrlock(rwlock->rwlock);
  +    stat = pthread_rwlock_trywrlock(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  @@ -173,7 +161,7 @@
   {
       apr_status_t stat;
   
  -    stat = pthread_rwlock_unlock(rwlock->rwlock);
  +    stat = pthread_rwlock_unlock(&rwlock->rwlock);
   #ifdef PTHREAD_SETS_ERRNO
       if (stat) {
           stat = errno;
  
  
  

Mime
View raw message