You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/06/01 02:09:56 UTC

svn commit: r543333 - /apr/apr/trunk/locks/win32/proc_mutex.c

Author: wrowe
Date: Thu May 31 17:09:55 2007
New Revision: 543333

URL: http://svn.apache.org/viewvc?view=rev&rev=543333
Log:
apr_proc_mutex_child_init calls unimplemented OpenMutexW and will fail to
compile on Windows CE.  The patch implements the expected behavior of
OpenMutexW by calling CreateMutex (which will open an existing mutex or 
create one if it doesn't exist) and close the mutex and return an error 
unless CreateMutex indicated that the mutex already existed.

PR: 39858
Submitted by: Curt Arnold <carnold apache.org>
Reviewed by: Davi Arnaut

Modified:
    apr/apr/trunk/locks/win32/proc_mutex.c

Modified: apr/apr/trunk/locks/win32/proc_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/locks/win32/proc_mutex.c?view=diff&rev=543333&r1=543332&r2=543333
==============================================================================
--- apr/apr/trunk/locks/win32/proc_mutex.c (original)
+++ apr/apr/trunk/locks/win32/proc_mutex.c Thu May 31 17:09:55 2007
@@ -98,6 +98,14 @@
      */
     mutexkey = res_name_from_filename(fname, 1, pool);
 
+#if defined(_WIN32_WCE)
+    hMutex = CreateMutex(NULL, FALSE, mutexkey);
+    if (hMutex && ERROR_ALREADY_EXISTS != GetLastError()) {
+        CloseHandle(hMutex);
+        hMutex = NULL;
+        SetLastError(ERROR_FILE_NOT_FOUND);
+    }
+#else
 #if APR_HAS_UNICODE_FS
     IF_WIN_OS_IS_UNICODE
     {
@@ -109,6 +117,7 @@
     {
         hMutex = OpenMutexA(MUTEX_ALL_ACCESS, FALSE, mutexkey);
     }
+#endif
 #endif
 
     if (!hMutex) {