summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-08-31 23:02:09 +0300
committerunknown <monty@hundin.mysql.fi>2001-08-31 23:02:09 +0300
commit4295917682a23b6f8d493d9433b0b7c1f244c421 (patch)
treee26c23520c4a8d41f977bce9e83f52bdd4b00fc4 /sql/sql_insert.cc
parent421e64ae356a1633ea50294b48c5025ea387a64d (diff)
downloadmariadb-git-4295917682a23b6f8d493d9433b0b7c1f244c421.tar.gz
Fixed problem with INSERT DELAYED
Make killing threads safer Docs/manual.texi: Portability fix mysys/thr_lock.c: Fixed problem with INSERT DELAYED sql/mysqld.cc: Make shutdown safer sql/sql_class.cc: Make kill thread safer sql/sql_insert.cc: Make kill thread safer
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index c14fbda3bc5..e6872fa1696 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -511,10 +511,12 @@ public:
delayed_row *row;
while ((row=rows.get()))
delete row;
- pthread_mutex_destroy(&mutex);
if (table)
close_thread_tables(&thd);
VOID(pthread_mutex_lock(&LOCK_thread_count));
+ pthread_mutex_destroy(&mutex);
+ pthread_cond_destroy(&cond);
+ pthread_cond_destroy(&cond_client);
thd.unlink(); // Must be unlinked under lock
x_free(thd.query);
thd.user=thd.host=0;
@@ -842,7 +844,7 @@ void kill_delayed_threads(void)
if (tmp->thd.mysys_var)
{
pthread_mutex_lock(&tmp->thd.mysys_var->mutex);
- if (tmp->thd.mysys_var->current_mutex)
+ if (tmp->thd.mysys_var->current_cond)
{
if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
@@ -970,7 +972,7 @@ static pthread_handler_decl(handle_delayed_insert,arg)
di->thd.proc_info=0;
DBUG_PRINT("info",("Waiting for someone to insert rows"));
- for ( ; ;)
+ while (!thd->killed)
{
int error;
#if (defined(HAVE_BROKEN_COND_TIMEDWAIT) || defined(HAVE_LINUXTHREADS))