apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/test aprtest.dsp
Date Mon, 10 Sep 2001 22:53:59 GMT
rbb         01/09/10 15:53:59

  Modified:    .        apr.dsp
               include/arch/win32 thread_mutex.h
               locks/win32 thread_mutex.c
               test     aprtest.dsp
  Log:
  Add the new thread_mutex API to the Windows build.  This works on
  my Windows box, but I am using MSVC 7, so my computer doesn't use
  project files anymore.  The C code is good, but somebody may have
  to hack the project files to make it all compile.  This passes the
  first half of the testlock test.  The second half is for read/write
  locks, which I will be implementing next.
  
  Revision  Changes    Path
  1.82      +24 -0     apr/apr.dsp
  
  Index: apr.dsp
  ===================================================================
  RCS file: /home/cvs/apr/apr.dsp,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- apr.dsp	2001/08/28 21:45:04	1.81
  +++ apr.dsp	2001/09/10 22:53:59	1.82
  @@ -165,6 +165,14 @@
   SOURCE=.\locks\win32\locks.c
   # End Source File
   # End Group
  +
  +SOURCE=.\locks\win32\thread_mutex.c
  +# End Source File
  +# End Group
  +
  +SOURCE=.\locks\win32\thread_rwlock.c
  +# End Source File
  +# End Group
   # Begin Group "memory"
   
   # PROP Default_Filter ""
  @@ -429,6 +437,14 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\include\arch\win32\thread_mutex.h
  +# End Source File
  +# End Group
  +
  +SOURCE=.\include\arch\win32\thread_rwlock.h
  +# End Source File
  +# End Group
  +
   SOURCE=.\include\arch\win32\threadproc.h
   # End Source File
   # End Group
  @@ -563,7 +579,15 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\include\apr_thread_mutex.h
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\include\apr_thread_proc.h
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\include\apr_thread_rwlock.h
   # End Source File
   # Begin Source File
   
  
  
  
  1.2       +1 -0      apr/include/arch/win32/thread_mutex.h
  
  Index: thread_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/thread_mutex.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- thread_mutex.h	2001/09/04 23:28:50	1.1
  +++ thread_mutex.h	2001/09/10 22:53:59	1.2
  @@ -59,6 +59,7 @@
   
   struct apr_thread_mutex_t {
       apr_pool_t *pool;
  +    CRITICAL_SECTION section;
   };
   
   #endif  /* THREAD_MUTEX_H */
  
  
  
  1.2       +23 -7     apr/locks/win32/thread_mutex.c
  
  Index: thread_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/win32/thread_mutex.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- thread_mutex.c	2001/09/04 23:28:51	1.1
  +++ thread_mutex.c	2001/09/10 22:53:59	1.2
  @@ -56,23 +56,39 @@
   #include "apr_private.h"
   #include "apr_general.h"
   #include "apr_strings.h"
  -#include "win32/thread_mutex.h"
  +#include "thread_mutex.h"
  +#include "apr_thread_mutex.h"
   #include "apr_portable.h"
   
   static apr_status_t thread_mutex_cleanup(void *data)
   {
  -    return APR_ENOTIMPL;
  +    apr_thread_mutex_t *lock = data;
  +
  +    DeleteCriticalSection(&lock->section);
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex,
                                                     apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    SECURITY_ATTRIBUTES sec;
  +    (*mutex) = (apr_thread_mutex_t *)apr_palloc(pool, sizeof(**mutex));
  +
  +    (*mutex)->pool = pool;
  +    sec.nLength = sizeof(SECURITY_ATTRIBUTES);
  +    sec.lpSecurityDescriptor = NULL;
  +    sec.bInheritHandle = FALSE;
  +
  +    InitializeCriticalSection(&(*mutex)->section);
  +    apr_pool_cleanup_register((*mutex)->pool, (*mutex), thread_mutex_cleanup,
  +                              apr_pool_cleanup_null);
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    EnterCriticalSection(&mutex->section);
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
  @@ -82,11 +98,11 @@
   
   APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    LeaveCriticalSection(&mutex->section);
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex)
   {
  -    return APR_ENOTIMPL;
  +    return apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup);
   }
  -
  
  
  
  1.12      +4 -0      apr/test/aprtest.dsp
  
  Index: aprtest.dsp
  ===================================================================
  RCS file: /home/cvs/apr/test/aprtest.dsp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- aprtest.dsp	2001/07/27 18:37:11	1.11
  +++ aprtest.dsp	2001/09/10 22:53:59	1.12
  @@ -124,6 +124,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\testlock.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\testmmap.c
   # End Source File
   # Begin Source File
  
  
  

Mime
View raw message