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 global_mutex.c
Date Wed, 20 Feb 2002 19:58:57 GMT
bnicholes    02/02/20 11:58:57

  Modified:    build    nw_export.inc
               locks/netware global_mutex.c
  Log:
  Implementation of the global mutex APIs
  
  Revision  Changes    Path
  1.3       +1 -0      apr/build/nw_export.inc
  
  Index: nw_export.inc
  ===================================================================
  RCS file: /home/cvs/apr/build/nw_export.inc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- nw_export.inc	29 Jan 2002 00:17:38 -0000	1.2
  +++ nw_export.inc	20 Feb 2002 19:58:57 -0000	1.3
  @@ -17,6 +17,7 @@
   #include "apr_fnmatch.h"
   #include "apr_general.h"
   #include "apr_getopt.h"
  +#include "apr_global_mutex.h"
   #include "apr_hash.h"
   #include "apr_inherit.h"
   #include "apr_lib.h"
  
  
  
  1.3       +30 -6     apr/locks/netware/global_mutex.c
  
  Index: global_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/netware/global_mutex.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- global_mutex.c	18 Feb 2002 13:06:43 -0000	1.2
  +++ global_mutex.c	20 Feb 2002 19:58:57 -0000	1.3
  @@ -54,13 +54,29 @@
   
   #include "apr.h"
   #include "apr_strings.h"
  +#include "global_mutex.h"
  +#include "apr_thread_mutex.h"
   
   APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex,
                                                     const char *fname,
                                                     apr_lockmech_e mech,
                                                     apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    apr_status_t ret;
  +    apr_global_mutex_t *new_mutex = NULL;
  +    new_mutex = (apr_global_mutex_t *)apr_pcalloc(pool, sizeof(apr_global_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_global_mutex_child_init(
  @@ -68,27 +84,35 @@
                                 const char *fname,
                                 apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_lock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_trylock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_unlock(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    if (mutex)
  +        return apr_thread_mutex_destroy(mutex->mutex);
  +    return APR_ENOLOCK;
   }
   
   APR_POOL_IMPLEMENT_ACCESSOR(global_mutex)
  
  
  

Mime
View raw message