summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAjo Robert <ajo.robert@oracle.com>2016-01-07 14:36:19 +0530
committerAjo Robert <ajo.robert@oracle.com>2016-01-07 14:36:19 +0530
commit3d1306f7b74077cfa197c8fa23baeb96c535af67 (patch)
treed6c2dae346f0cbafed48ff2a04093f0fa654a99b /include
parent8c65e082f397a34cf393cfc6019daaa303ef5151 (diff)
downloadmariadb-git-3d1306f7b74077cfa197c8fa23baeb96c535af67.tar.gz
Bug#21770366 backport bug#21657078 to 5.5 and 5.6
Problem Statement ========= Fix various issues when building MySQL with Visual Studio 2015. Fix: ======= - Visual Studio 2015 adds support for timespec. Add check and related code to use this and only use our replacement if timespec is not defined. - Rename lfind/lsearch to my* to avoid redefinition problems. - Set default value for TMPDIR to "" on Windows as P_tmpdir no longer exists. - using VS definition of snprintf if available - tzname are now renamed to _tzname.
Diffstat (limited to 'include')
-rw-r--r--include/my_pthread.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 92676bd727c..6ff198ac6f3 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -90,6 +90,7 @@ typedef volatile LONG my_pthread_once_t;
windows implementation of pthread_cond_timedwait
*/
+#ifndef HAVE_STRUCT_TIMESPEC
/*
Declare a union to make sure FILETIME is properly aligned
so it can be used directly as a 64 bit value. The value
@@ -128,6 +129,7 @@ struct timespec {
((TS1.tv.i64 > TS2.tv.i64) ? 1 : \
((TS1.tv.i64 < TS2.tv.i64) ? -1 : 0))
+#endif
int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
@@ -433,13 +435,7 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif /* !set_timespec_nsec */
#else
#ifndef set_timespec
-#define set_timespec(ABSTIME,SEC) \
-{\
- struct timeval tv;\
- gettimeofday(&tv,0);\
- (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
- (ABSTIME).tv_nsec=tv.tv_usec*1000;\
-}
+#define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL)
#endif /* !set_timespec */
#ifndef set_timespec_nsec
#define set_timespec_nsec(ABSTIME,NSEC) \