summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-05-05 11:36:53 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2017-05-05 11:36:53 +0200
commita903be5d964fcda2c7f6eb649885dbd98901fb72 (patch)
treec4714d265a82b3c7aef7188853b439d8d54b8bf5 /include/my_pthread.h
parent1f63feb91a027cdccbf3c14d513d11acf8aa7431 (diff)
parent6935d66053b2c9723314d89d5169dcf34ed56c08 (diff)
downloadmariadb-git-10.2-wlad-merge.tar.gz
Merge commit '6935d66053b2c9723314d89d5169dcf34ed56c08' into bb-10.2-marko10.2-wlad-merge
# Conflicts: # debian/control # debian/mariadb-server-10.2.install # include/my_sys.h # mysql-test/collections/buildbot_suites.bat # plugin/auth_dialog/CMakeLists.txt # sql/CMakeLists.txt # sql/sql_class.cc # storage/innobase/CMakeLists.txt # storage/innobase/log/log0crypt.cc # win/packaging/CPackWixConfig.cmake
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index a69e0c49f55..672bca5ab39 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -346,6 +346,26 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
} while(0)
#endif /* !set_timespec_time_nsec */
+#ifdef MYSQL_CLIENT
+#define _current_thd() NULL
+#elif defined(_WIN32)
+#ifdef __cplusplus
+extern "C"
+#endif
+MYSQL_THD _current_thd_noinline();
+#define _current_thd() _current_thd_noinline()
+#else
+/*
+ THR_THD is a key which will be used to set/get THD* for a thread,
+ using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
+*/
+extern pthread_key(MYSQL_THD, THR_THD);
+static inline MYSQL_THD _current_thd(void)
+{
+ return my_pthread_getspecific_ptr(MYSQL_THD,THR_THD);
+}
+#endif
+
/* safe_mutex adds checking to mutex for easier debugging */
struct st_hash;
typedef struct st_safe_mutex_t