summaryrefslogtreecommitdiff
path: root/locks/win32/thread_mutex.c
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2019-05-27 17:11:23 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2019-05-27 17:11:23 +0000
commit5a0567d0470e8be395c0299306786a98992c6f25 (patch)
treec21f1deecd4de7b23398e40dddc6884bf5a2831f /locks/win32/thread_mutex.c
parenta7a7248520a64aa924e24c44c9d75bf4bb2d893a (diff)
downloadlibapr-5a0567d0470e8be395c0299306786a98992c6f25.tar.gz
On 'xmllite' branch: Merge changes from trunk.xmllite
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/xmllite@1860149 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/win32/thread_mutex.c')
-rw-r--r--locks/win32/thread_mutex.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/locks/win32/thread_mutex.c b/locks/win32/thread_mutex.c
index f19152495..165e34c22 100644
--- a/locks/win32/thread_mutex.c
+++ b/locks/win32/thread_mutex.c
@@ -118,26 +118,9 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex,
apr_interval_time_t timeout)
{
if (mutex->type != thread_mutex_critical_section) {
- DWORD rv, timeout_ms = 0;
- apr_interval_time_t t = timeout;
-
- do {
- if (t > 0) {
- /* Given timeout is 64bit usecs whereas Windows timeouts are
- * 32bit msecs and below INFINITE (2^32 - 1), so we may need
- * multiple timed out waits...
- */
- if (t > apr_time_from_msec(INFINITE - 1)) {
- timeout_ms = INFINITE - 1;
- t -= apr_time_from_msec(INFINITE - 1);
- }
- else {
- timeout_ms = (DWORD)apr_time_as_msec(t);
- t = 0;
- }
- }
- rv = WaitForSingleObject(mutex->handle, timeout_ms);
- } while (rv == WAIT_TIMEOUT && t > 0);
+ DWORD rv;
+
+ rv = apr_wait_for_single_object(mutex->handle, timeout);
if ((rv != WAIT_OBJECT_0) && (rv != WAIT_ABANDONED)) {
return (rv == WAIT_TIMEOUT) ? APR_TIMEUP : apr_get_os_error();