apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/include/arch/win32 fileio.h
Date Tue, 27 Nov 2001 02:39:19 GMT
wrowe       01/11/26 18:39:19

  Modified:    file_io/win32 open.c readwrite.c
               include/arch/win32 fileio.h
  Log:
    Convert Win32 to apr_thread_mutex locking, rather than apr_lock.
    [Aaron Bannert]
  
    This does _not_ work on win9x, but the CancelIo call right there
    doesn't work either, so why hold up progress?  The right solution is
    to emulate thread_mutex locking on 9x, so this patch is ultimately
    correct on all Win flavors.
  
  Revision  Changes    Path
  1.85      +5 -3      apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- open.c	2001/10/10 17:36:12	1.84
  +++ open.c	2001/11/27 02:39:19	1.85
  @@ -58,6 +58,7 @@
   #include "apr_general.h"
   #include "apr_strings.h"
   #include "apr_portable.h"
  +#include "apr_thread_mutex.h"
   #include <errno.h>
   #include <winbase.h>
   #include <string.h>
  @@ -268,7 +269,8 @@
       if (flag & APR_BUFFERED) {
           (*new)->buffered = 1;
           (*new)->buffer = apr_palloc(cont, APR_FILE_BUFSIZE);
  -        rv = apr_lock_create(&(*new)->mutex, APR_MUTEX, APR_INTRAPROCESS, NULL,
cont);
  +        rv = apr_thread_mutex_create(&(*new)->mutex, APR_THREAD_MUTEX_DEFAULT,
  +                                     cont);
   
           if (rv) {
               if (file_cleanup(*new) == APR_SUCCESS) {
  @@ -314,7 +316,7 @@
           apr_pool_cleanup_kill(file->cntxt, file, file_cleanup);
   
           if (file->buffered)
  -            apr_lock_destroy(file->mutex);
  +            apr_thread_mutex_destroy(file->mutex);
   
           return APR_SUCCESS;
       }
  @@ -460,4 +462,4 @@
   
   APR_DECLARE_UNSET_INHERIT(file) {
       return;
  -}
  \ No newline at end of file
  +}
  
  
  
  1.63      +6 -4      apr/file_io/win32/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- readwrite.c	2001/10/16 12:24:33	1.62
  +++ readwrite.c	2001/11/27 02:39:19	1.63
  @@ -137,6 +137,7 @@
                   break;
               }
               if (rv != APR_SUCCESS) {
  +                /* XXX CancelIo is not available on Win95 */
                   CancelIo(file->filehand);
               }
           }
  @@ -184,7 +185,7 @@
           apr_size_t blocksize;
           apr_size_t size = *len;
   
  -        apr_lock_acquire(thefile->mutex);
  +        apr_thread_mutex_lock(thefile->mutex);
   
           if (thefile->direction == 1) {
               apr_file_flush(thefile);
  @@ -222,7 +223,7 @@
           if (*len) {
               rv = APR_SUCCESS;
           }
  -        apr_lock_release(thefile->mutex);
  +        apr_thread_mutex_unlock(thefile->mutex);
       } else {  
           /* Unbuffered i/o */
           apr_size_t nbytes;
  @@ -243,7 +244,7 @@
           apr_size_t blocksize;
           apr_size_t size = *nbytes;
   
  -        apr_lock_acquire(thefile->mutex);
  +        apr_thread_mutex_lock(thefile->mutex);
   
           if (thefile->direction == 0) {
               // Position file pointer for writing at the offset we are logically reading
from
  @@ -268,7 +269,7 @@
               size -= blocksize;
           }
   
  -        apr_lock_release(thefile->mutex);
  +        apr_thread_mutex_unlock(thefile->mutex);
           return rv;
       } else {
           if (thefile->pOverlapped && !thefile->pipe) {
  @@ -304,6 +305,7 @@
                           break;
                   }
                   if (rv != APR_SUCCESS) {
  +                    /* XXX CancelIo is not available on Win95 */
                       CancelIo(thefile->filehand);
                   }
               }
  
  
  
  1.60      +2 -2      apr/include/arch/win32/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/fileio.h,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- fileio.h	2001/11/12 16:58:37	1.59
  +++ fileio.h	2001/11/27 02:39:19	1.60
  @@ -60,7 +60,7 @@
   #include "apr_pools.h"
   #include "apr_general.h"
   #include "apr_tables.h"
  -#include "apr_lock.h"
  +#include "apr_thread_mutex.h"
   #include "apr_file_io.h"
   #include "apr_file_info.h"
   #include "apr_errno.h"
  @@ -200,7 +200,7 @@
       apr_size_t dataRead;       // amount of valid data read into buffer
       int direction;             // buffer being used for 0 = read, 1 = write
       apr_off_t filePtr;         // position in file of handle
  -    apr_lock_t *mutex;         // mutex semaphore, must be owned to access the above fields
  +    apr_thread_mutex_t *mutex; // mutex semaphore, must be owned to access the above fields
   
       /* Pipe specific info */    
   };
  
  
  

Mime
View raw message