This patch converts the INTRAPROCESS locks to apr_thread_mutex_t calls in win32's fileio routines. I have no way to test this, so could one of you win32 gurus check it out for me?
-aaron Index: file_io/win32/open.c =================================================================== RCS file: /home/cvs/apr/file_io/win32/open.c,v retrieving revision 1.84 diff -u -r1.84 open.c --- file_io/win32/open.c 2001/10/10 17:36:12 1.84 +++ file_io/win32/open.c 2001/11/21 04:28:26 @@ -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 +} Index: file_io/win32/readwrite.c =================================================================== RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v retrieving revision 1.62 diff -u -r1.62 readwrite.c --- file_io/win32/readwrite.c 2001/10/16 12:24:33 1.62 +++ file_io/win32/readwrite.c 2001/11/21 04:28:27 @@ -184,7 +184,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 +222,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 +243,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 +268,7 @@ size -= blocksize; } - apr_lock_release(thefile->mutex); + apr_thread_mutex_unlock(thefile->mutex); return rv; } else { if (thefile->pOverlapped && !thefile->pipe) { Index: include/arch/win32/fileio.h =================================================================== RCS file: /home/cvs/apr/include/arch/win32/fileio.h,v retrieving revision 1.59 diff -u -r1.59 fileio.h --- include/arch/win32/fileio.h 2001/11/12 16:58:37 1.59 +++ include/arch/win32/fileio.h 2001/11/21 04:28:27 @@ -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 */ };