apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/locks/netware proc_mutex.c
Date Fri, 08 Feb 2002 22:12:31 GMT
bnicholes    02/02/08 14:12:31

  Modified:    include/arch/netware proc_mutex.h
               locks/netware proc_mutex.c
  Log:
  Piggy-backed the proc_mutexes on the thread_mutexes since all resources
  are shared on NetWare.  There is no difference between a thread mutex and
  a proc mutex.
  
  Revision  Changes    Path
  1.2       +2 -1      apr/include/arch/netware/proc_mutex.h
  
  Index: proc_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/netware/proc_mutex.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- proc_mutex.h	19 Sep 2001 20:06:43 -0000	1.1
  +++ proc_mutex.h	8 Feb 2002 22:12:31 -0000	1.2
  @@ -56,10 +56,11 @@
   #define PROC_MUTEX_H
   
   #include "apr_proc_mutex.h"
  -#include <nks/synch.h>
  +#include "apr_thread_mutex.h"
   
   struct apr_proc_mutex_t {
       apr_pool_t *pool;
  +    apr_thread_mutex_t *mutex;
   };
   
   #endif  /* PROC_MUTEX_H */
  
  
  
  1.6       +33 -10    apr/locks/netware/proc_mutex.c
  
  Index: proc_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/netware/proc_mutex.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- proc_mutex.c	8 Jan 2002 21:00:37 -0000	1.5
  +++ proc_mutex.c	8 Feb 2002 22:12:31 -0000	1.6
  @@ -54,44 +54,65 @@
   
   #include "apr.h"
   #include "apr_private.h"
  -#include "apr_general.h"
  -#include "apr_strings.h"
  -#include "proc_mutex.h"
   #include "apr_portable.h"
  +#include "proc_mutex.h"
  +#include "thread_mutex.h"
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
                                                   const char *fname,
                                                   apr_lockmech_e mech,
                                                   apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    apr_status_t ret;
  +    apr_proc_mutex_t *new_mutex = NULL;
  +    new_mutex = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t));
  +	
  +	if(new_mutex ==NULL) {
  +        return APR_ENOMEM;
  +    }     
  +    
  +    new_mutex->pool = pool;
  +    ret = apr_thread_mutex_create(&(new_mutex->mutex), APR_THREAD_MUTEX_DEFAULT,
pool);
  +
  +    if (ret == APR_SUCCESS)
  +        *mutex = new_mutex;
  +
  +    return ret;
   }
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
                                                       const char *fname,
                                                       apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    return APR_SUCCESS;
   }
       
   APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_lock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_trylock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_unlock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_destroy(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
  @@ -101,7 +122,9 @@
   apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
                                      apr_proc_mutex_t *pmutex)
   {
  -    return APR_ENOTIMPL;
  +    if (pmutex)
  +        ospmutex = pmutex->mutex->mutex;
  +    return APR_ENOLOCK;
   }
   
   apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
  
  
  

Mime
View raw message