diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2007-06-01 00:09:55 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2007-06-01 00:09:55 +0000 |
commit | e9fc4f6248f26c5a26b1f939bc47b2b38e3b5b48 (patch) | |
tree | 2630bdc6871346c763d59eee83a5887f4f9ac90c /locks/win32 | |
parent | 78d8b8d2bd6a48a69b93c31c9015acebd728f50b (diff) | |
download | apr-e9fc4f6248f26c5a26b1f939bc47b2b38e3b5b48.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
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@543333 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/win32')
-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 1033a1c34..ecb6f14d4 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(); |