summaryrefslogtreecommitdiff
path: root/mysys
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 /mysys
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 'mysys')
-rw-r--r--mysys/cmakelists.txt7
-rw-r--r--mysys/my_init.c6
2 files changed, 9 insertions, 4 deletions
diff --git a/mysys/cmakelists.txt b/mysys/cmakelists.txt
index ceecc1368ec..1048bf61eec 100644
--- a/mysys/cmakelists.txt
+++ b/mysys/cmakelists.txt
@@ -1,5 +1,8 @@
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
+# Need to set USE_TLS, since mysys is linked into libmysql.dll and
+# libmysqld.dll, and __declspec(thread) approach to thread local storage does
+# not work properly in DLLs.
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR -DUSE_TLS")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR -DUSE_TLS")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_modify.c
diff --git a/mysys/my_init.c b/mysys/my_init.c
index efeee0fbc76..31757cd5df0 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -134,7 +134,10 @@ void my_end(int infoflag)
*/
FILE *info_file= DBUG_FILE;
my_bool print_info= (info_file != stderr);
- DBUG_ENTER("my_end");
+ /* We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
+ operational, so we cannot use DBUG_RETURN.
+ */
+ DBUG_PRINT("info",("Shutting down"));
if (!info_file)
{
info_file= stderr;
@@ -214,7 +217,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
WSACleanup();
#endif /* __WIN__ */
my_init_done=0;
- DBUG_VOID_RETURN;
} /* my_end */