summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-04-24 15:39:47 +0200
committerSergei Golubchik <serg@mariadb.org>2017-04-27 19:12:37 +0200
commit99e1294c1e2ddd0bbd81129f1c0902be31a38f48 (patch)
treea5ef2bbbef5e45d81d29eef6d3fe8ef85245f8b1 /include
parent2c3f5787896f1278e240095c49539ad7baf77d8b (diff)
downloadmariadb-git-99e1294c1e2ddd0bbd81129f1c0902be31a38f48.tar.gz
bugfix: federated/replication did not increment bytes_received status variable
because mysql->net.thd was reset to NULL in mysql_real_connect() and thd_increment_bytes_received() didn't do anything. Fix: * set mysql->net.thd to current_thd instread. * remove the test for non-null THD from a very often used function thd_increment_bytes_received().
Diffstat (limited to 'include')
-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 37576ac3cb4..6b830ca36d2 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -367,6 +367,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