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:13:57 UTC

svn commit: r543334 - /apr/apr/branches/1.2.x/locks/win32/proc_mutex.c

Author: wrowe
Date: Thu May 31 17:13:57 2007
New Revision: 543334

URL: http://svn.apache.org/viewvc?view=rev&rev=543334
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
Backport: 543333

Modified:
    apr/apr/branches/1.2.x/locks/win32/proc_mutex.c

Modified: apr/apr/branches/1.2.x/locks/win32/proc_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/locks/win32/proc_mutex.c?view=diff&rev=543334&r1=543333&r2=543334
==============================================================================
--- apr/apr/branches/1.2.x/locks/win32/proc_mutex.c (original)
+++ apr/apr/branches/1.2.x/locks/win32/proc_mutex.c Thu May 31 17:13:57 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) {