diff options
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 51b2c84cfea..f6135e8b168 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2752,9 +2752,10 @@ void kill_delayed_threads(void) Delayed_insert *di; while ((di= it++)) { + mysql_mutex_lock(&di->thd.LOCK_thd_kill); mysql_mutex_lock(&di->thd.LOCK_thd_data); if (di->thd.killed < KILL_CONNECTION) - di->thd.set_killed(KILL_CONNECTION); + di->thd.set_killed_no_mutex(KILL_CONNECTION); if (di->thd.mysys_var) { mysql_mutex_lock(&di->thd.mysys_var->mutex); @@ -2773,6 +2774,7 @@ void kill_delayed_threads(void) mysql_mutex_unlock(&di->thd.mysys_var->mutex); } mysql_mutex_unlock(&di->thd.LOCK_thd_data); + mysql_mutex_unlock(&di->thd.LOCK_thd_kill); } mysql_mutex_unlock(&LOCK_delayed_insert); // For unlink from list DBUG_VOID_RETURN; @@ -3139,10 +3141,12 @@ pthread_handler_t handle_delayed_insert(void *arg) THD::notify_shared_lock() dosn't try to access open tables after this. */ + mysql_mutex_lock(&thd->LOCK_thd_kill); mysql_mutex_lock(&thd->LOCK_thd_data); - thd->set_killed(KILL_CONNECTION_HARD); // If error + thd->set_killed_no_mutex(KILL_CONNECTION_HARD); // If error thd->mdl_context.set_needs_thr_lock_abort(0); mysql_mutex_unlock(&thd->LOCK_thd_data); + mysql_mutex_unlock(&thd->LOCK_thd_kill); close_thread_tables(thd); // Free the table thd->release_transactional_locks(); |