diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-06-01 00:14:00 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-06-01 00:14:00 +0000 |
commit | 6b0039bf11d3dd6b83df749cf732413c59e8e4ae (patch) | |
tree | 4b661cf5ffe7dcfa685f92a051094542e76e1721 | |
parent | f547a60a5be46cdac420df8598e68b5e58e16a9a (diff) | |
download | libapr-6b0039bf11d3dd6b83df749cf732413c59e8e4ae.tar.gz |
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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@543335 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | locks/win32/proc_mutex.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/locks/win32/proc_mutex.c b/locks/win32/proc_mutex.c index d3cd1d8b2..3b249045a 100644 --- a/locks/win32/proc_mutex.c +++ b/locks/win32/proc_mutex.c @@ -98,6 +98,14 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, */ 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 { @@ -110,6 +118,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, hMutex = OpenMutexA(MUTEX_ALL_ACCESS, FALSE, mutexkey); } #endif +#endif if (!hMutex) { return apr_get_os_error(); |