diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2009-12-12 19:11:25 +0100 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2009-12-12 19:11:25 +0100 |
commit | 8969530cffde0c7a466cf3aa8c4b7462d0ace2d2 (patch) | |
tree | e11d1534328b91e686c5a4590990a39cf3e6eeb6 /libmysql | |
parent | 0654e74a708247a461953726b3f4d3e18b78b6d4 (diff) | |
download | mariadb-git-8969530cffde0c7a466cf3aa8c4b7462d0ace2d2.tar.gz |
Bug #45058 init_available_charsets uses double checked locking
As documented in the bug report, the double checked locking
pattern has inherent issues, and cannot guarantee correct
initialization.
This patch replaces the logic in init_available_charsets()
with the use of pthread_once(3). A wrapper function,
my_pthread_once(), is introduced and is used in lieu of direct
calls to init_available_charsets(). Related defines
MY_PTHREAD_ONCE_* are also introduced.
For the Windows platform, the implementation in lp:sysbench is
ported. For single-thread use, a simple define calls the
function and sets the pthread_once control variable.
Charset initialization is modified to use my_pthread_once().
include/my_no_pthread.h:
Dummy my_pthread_once() for single thread use.
include/my_pthread.h:
Declaration for new function my_pthread_once().
mysys/charset.c:
Logic in init_available_charsets() is simplified.
Using my_pthread_once() for all calls to this func.
mysys/my_winthread.c:
Windows implementation of my_pthread_once().
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 1264f2765ba..36b1d9cac72 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -211,7 +211,6 @@ void STDCALL mysql_server_end() } else { - free_charsets(); mysql_thread_end(); } |