summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.mysql.com>2007-10-03 21:38:32 +0200
committerunknown <msvensson@pilot.mysql.com>2007-10-03 21:38:32 +0200
commit662fb20f1e03a5d4146a67b5e73c828f5ab476e4 (patch)
treec537085b7010b4e17f0b3c2e7bc1d3f2e8bf2311 /include
parent6a5c7fc3b86cf7df5ce5abba99a7008911964461 (diff)
downloadmariadb-git-662fb20f1e03a5d4146a67b5e73c828f5ab476e4.tar.gz
Bug#30992 Wrong implementation of pthread_mutex_trylock()
It's not possible to use WaitForSingleObject to wait on a CRITICAL_SECTION, instead use the TryEnterCriticalSection function. - if "mutex" was already taken => return EBUSY - if "mutex" was aquired => return 0 include/config-win.h: Make windows.h define TryEnterCriticalSection mysys/my_winthread.c: Use the TryEnterCriticalSection function to implement pthread_mutex_trylock Prevent recursive behaviour by looking at the RecursionCount variable in the CRITICAL_SECTION struct and return EBUSY from function if the mutex was already locked once.
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/config-win.h b/include/config-win.h
index 279be7aa5e4..f0804a368bc 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -19,6 +19,9 @@
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT 0x0500
+#else
+/* Get NT 4.0 functions */
+#define _WIN32_WINNT 0x0400
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400