summaryrefslogtreecommitdiff
path: root/locks/win32/thread_mutex.c
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2001-09-13 02:50:07 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2001-09-13 02:50:07 +0000
commit484e4093928e3fe29e2edc0962ff1f00422757ea (patch)
tree25a11acbf9a7590e28a4074a1c0bd96eea01f1e0 /locks/win32/thread_mutex.c
parent5beca5e6c79a5bbcf840f871a1165d182c754f1f (diff)
downloadlibapr-484e4093928e3fe29e2edc0962ff1f00422757ea.tar.gz
Implement apr_thread_mutex_trylock on Windows
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62318 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/win32/thread_mutex.c')
-rw-r--r--locks/win32/thread_mutex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/locks/win32/thread_mutex.c b/locks/win32/thread_mutex.c
index e78ab21f8..86360c36e 100644
--- a/locks/win32/thread_mutex.c
+++ b/locks/win32/thread_mutex.c
@@ -88,7 +88,12 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
{
- return APR_ENOTIMPL;
+ BOOL status;
+ status = TryEnterCriticalSection(&mutex->section);
+ if (status) {
+ return APR_SUCCESS;
+ }
+ return APR_EBUSY;
}
APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)