Commit 8bf7aae2 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

fix application verifier crashes

parent 87b6f241
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#pragma comment(lib, "ws2_32") #pragma comment(lib, "ws2_32")
#endif #endif
my_bool have_tcpip=0; my_bool have_tcpip=0;
extern pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
static void my_win_init(void); static void my_win_init(void);
static my_bool win32_init_tcp_ip(); static my_bool win32_init_tcp_ip();
#else #else
...@@ -221,7 +222,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", ...@@ -221,7 +222,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
if (have_tcpip) if (have_tcpip)
WSACleanup(); WSACleanup();
#endif /* __WIN__ */ #endif /* __WIN__ */
/* At very last, delete mysys key, it is used everywhere including DBUG */
pthread_key_delete(THR_KEY_mysys);
my_init_done=0; my_init_done=0;
} /* my_end */ } /* my_end */
......
...@@ -274,7 +274,6 @@ void my_thread_global_end(void) ...@@ -274,7 +274,6 @@ void my_thread_global_end(void)
*/ */
if (all_threads_killed) if (all_threads_killed)
{ {
pthread_key_delete(THR_KEY_mysys);
my_thread_destroy_internal_mutex(); my_thread_destroy_internal_mutex();
} }
my_thread_global_init_done= 0; my_thread_global_init_done= 0;
......
...@@ -423,6 +423,8 @@ static void wt_resource_destroy(uchar *arg) ...@@ -423,6 +423,8 @@ static void wt_resource_destroy(uchar *arg)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static int wt_init_done;
void wt_init() void wt_init()
{ {
DBUG_ENTER("wt_init"); DBUG_ENTER("wt_init");
...@@ -456,18 +458,22 @@ void wt_init() ...@@ -456,18 +458,22 @@ void wt_init()
my_atomic_rwlock_init(&cycle_stats_lock); my_atomic_rwlock_init(&cycle_stats_lock);
my_atomic_rwlock_init(&success_stats_lock); my_atomic_rwlock_init(&success_stats_lock);
my_atomic_rwlock_init(&wait_stats_lock); my_atomic_rwlock_init(&wait_stats_lock);
wt_init_done= 1;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void wt_end() void wt_end()
{ {
DBUG_ENTER("wt_end"); DBUG_ENTER("wt_end");
if (!wt_init_done)
DBUG_VOID_RETURN;
DBUG_ASSERT(reshash.count == 0); DBUG_ASSERT(reshash.count == 0);
lf_hash_destroy(&reshash); lf_hash_destroy(&reshash);
my_atomic_rwlock_destroy(&cycle_stats_lock); my_atomic_rwlock_destroy(&cycle_stats_lock);
my_atomic_rwlock_destroy(&success_stats_lock); my_atomic_rwlock_destroy(&success_stats_lock);
my_atomic_rwlock_destroy(&wait_stats_lock); my_atomic_rwlock_destroy(&wait_stats_lock);
wt_init_done= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment