summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-10-22 14:31:41 -0600
committerunknown <tsmith@ramayana.hindu.god>2007-10-22 14:31:41 -0600
commit966e3df37474b892c23c2516467768393adb7f32 (patch)
treed4da934316ff460ee7786d4aa4318777fa1922e8 /include
parent89cca4b3696a7a958eaae030aeff38b47a9fd7d1 (diff)
parentfb9a562b1cc2b9048eff094bb7004fb3db0e7fd0 (diff)
downloadmariadb-git-966e3df37474b892c23c2516467768393adb7f32.tar.gz
Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into ramayana.hindu.god:/home/tsmith/m/bk/maint/50
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h3
-rw-r--r--include/my_pthread.h9
2 files changed, 8 insertions, 4 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
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 1cedbbc4fd0..13b7cf93d6f 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -116,6 +116,7 @@ struct timespec {
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
+int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
@@ -176,7 +177,7 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#else
#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
-#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
+#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A))
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
@@ -574,7 +575,7 @@ typedef struct st_safe_mutex_info_t
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
const char *file, uint line);
-int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
+int safe_mutex_lock(safe_mutex_t *mp, my_bool try_lock, const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
@@ -597,12 +598,12 @@ void safe_mutex_end(FILE *file);
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__)
-#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
+#define pthread_mutex_lock(A) safe_mutex_lock((A), FALSE, __FILE__, __LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
-#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
+#define pthread_mutex_trylock(A) safe_mutex_lock((A), TRUE, __FILE__, __LINE__)
#define pthread_mutex_t safe_mutex_t
#define safe_mutex_assert_owner(mp) \
DBUG_ASSERT((mp)->count > 0 && \