mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Make killing of threads safer
Docs/manual.texi: Changelog sql/sql_insert.cc: Fix problem with INSERT DELAYED during shutdown
This commit is contained in:
@ -414,12 +414,10 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
||||
log.error=0;
|
||||
|
||||
// tell the kill thread how to wake us up
|
||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||
thd->mysys_var->current_mutex = log_lock;
|
||||
thd->mysys_var->current_cond = &COND_binlog_update;
|
||||
const char* proc_info = thd->proc_info;
|
||||
thd->proc_info = "Slave connection: waiting for binlog update";
|
||||
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
||||
|
||||
bool read_packet = 0, fatal_error = 0;
|
||||
|
||||
@ -444,7 +442,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
||||
break;
|
||||
case LOG_READ_EOF:
|
||||
DBUG_PRINT("wait",("waiting for data on binary log"));
|
||||
pthread_cond_wait(&COND_binlog_update, log_lock);
|
||||
if (!thd->killed)
|
||||
pthread_cond_wait(&COND_binlog_update, log_lock);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -694,9 +693,9 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||
|
||||
thr_alarm_kill(tmp->real_id);
|
||||
tmp->killed = 1;
|
||||
pthread_mutex_lock(&tmp->mysys_var->mutex);
|
||||
tmp->mysys_var->abort = 1;
|
||||
if(tmp->mysys_var->current_mutex)
|
||||
pthread_mutex_lock(&tmp->mysys_var->mutex);
|
||||
if(tmp->mysys_var->current_cond)
|
||||
{
|
||||
pthread_mutex_lock(tmp->mysys_var->current_mutex);
|
||||
pthread_cond_broadcast(tmp->mysys_var->current_cond);
|
||||
|
Reference in New Issue
Block a user