summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
authorunknown <knielsen@mysql.com>2006-03-22 09:55:26 +0100
committerunknown <knielsen@mysql.com>2006-03-22 09:55:26 +0100
commite29144b4b5bedd1239c0045f73316a42eda1521d (patch)
tree2baa2b3b734e54ff428f3a5228d8d943681c23be /include/my_pthread.h
parentc8caeebf854d8df94b39c72d3003245fa1d372db (diff)
downloadmariadb-git-e29144b4b5bedd1239c0045f73316a42eda1521d.tar.gz
Define USE_TLS when compiling libmysql.dll, to avoid crashing when
loaded at runtime. extra/comp_err.c: Don't use DBUG after my_end, crashes on Windows with USE_TLS. include/my_dbug.h: Add missing DBUG_LEAVE in non-debug builds. include/my_pthread.h: Add comment explaining USE_TLS. libmysql/cmakelists.txt: Add USE_TLS to avoid crashing when loading libmysql.dll at runtime. mysys/cmakelists.txt: Add USE_TLS to avoid crashing when loading libmysql.dll at runtime. mysys/my_init.c: Don't use DBUG after my_thread_end(), as it crashes on Windows TLS.
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 81100fe2b88..9146cab8589 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -116,6 +116,13 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
+/*
+ Windows has two ways to use thread local storage. The most efficient
+ is using __declspec(thread), but that does not work properly when
+ used in a .dll that is loaded at runtime, after program load. So for
+ libmysql.dll and libmysqld.dll we define USE_TLS in order to use the
+ TlsXxx() API instead, which works in all cases.
+*/
#ifdef USE_TLS /* For LIBMYSQL.DLL */
#undef SAFE_MUTEX /* This will cause conflicts */
#define pthread_key(T,V) DWORD V