stoddard 02/02/27 19:33:37
Modified: . CHANGES
locks/win32 proc_mutex.c
Log:
Win32: Fix apr_proc_mutex_lock/trylock. Getting WAIT_ABANDONED is
not a failure condition when calling WaitForSingleObject on a mutex.
Revision Changes Path
1.230 +8 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -r1.229 -r1.230
--- CHANGES 28 Feb 2002 02:57:30 -0000 1.229
+++ CHANGES 28 Feb 2002 03:33:37 -0000 1.230
@@ -1,4 +1,12 @@
Changes with APR b1
+ *) Win32: apr_proc_mutex_trylock and apr_proc_mutex_lock were
+ incorrectly returning APR_BUSY if the lock was previously
+ held by a thread that exited before releasing the lock
+ (ie, if the process holding the lock segfaults). The MSDN
+ doc says when WaitForSingleObject returns WAIT_ABANDONED,
+ the calling thread takes ownership of the mutex, so these
+ two routines should return APR_SUCCESS in this case, not
+ APR_BUSY. [Bill Stoddard]
*) Added a new m4 function APR_EXPAND_VAR that will iteratively
interpolate the contents of a variable, such as $sysconfdir,
1.7 +2 -8 apr/locks/win32/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/win32/proc_mutex.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- proc_mutex.c 27 Feb 2002 17:39:06 -0000 1.6
+++ proc_mutex.c 28 Feb 2002 03:33:37 -0000 1.7
@@ -139,12 +139,9 @@
rv = WaitForSingleObject(mutex->handle, INFINITE);
- if (rv == WAIT_OBJECT_0) {
+ if (rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
return APR_SUCCESS;
}
- else if (rv == WAIT_ABANDONED) {
- return APR_EBUSY;
- }
return apr_get_os_error();
}
@@ -154,11 +151,8 @@
rv = WaitForSingleObject(mutex->handle, 0);
- if (rv == WAIT_OBJECT_0) {
+ if (rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
return APR_SUCCESS;
- }
- else if (rv == WAIT_ABANDONED) {
- return APR_EBUSY;
}
return apr_get_os_error();
}