summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <iggy@amd64.(none)>2008-03-28 14:20:21 -0400
committerunknown <iggy@amd64.(none)>2008-03-28 14:20:21 -0400
commitf6bd80dc372dddccde77ea0e4a20ec4f3f136e7f (patch)
treec56b0de160b439319a1e6d4987378d9a627fd3fb
parent548b389f3ac68323583c0819fd640d12bf1bc46c (diff)
parenta9089cf460c7d7be3d8b843c948f0c707822878e (diff)
downloadmariadb-git-f6bd80dc372dddccde77ea0e4a20ec4f3f136e7f.tar.gz
Merge amd64.(none):/src/bug26243/my50-bug26243
into amd64.(none):/src/bug26243/my51-bug26243 dbug/factorial.c: Auto merged dbug/user.r: Auto merged include/my_dbug.h: Auto merged libmysql/libmysql.c: Auto merged sql/item_cmpfunc.cc: Auto merged sql/net_serv.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_select.cc: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged storage/myisam/mi_open.c: Auto merged tests/mysql_client_test.c: Auto merged dbug/dbug.c: Null Merge sql/mysqld.cc: Null Merge sql/opt_range.cc: Null Merge sql/set_var.cc: Null Merge sql/slave.cc: Null Merge storage/federated/ha_federated.cc: Null Merge storage/myisammrg/ha_myisammrg.cc: Null Merge client/mysql.cc: Manual Merge
-rw-r--r--client/mysql.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 79d8ef0a35c..234180c3c75 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1269,12 +1269,12 @@ sig_handler handle_sigint(int sig)
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || interrupted_query)
- mysql_end(sig);
+ goto err;
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
- mysql_end(sig);
+ goto err;
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
@@ -1283,6 +1283,22 @@ sig_handler handle_sigint(int sig)
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
interrupted_query= 1;
+
+ return;
+
+err:
+#ifdef _WIN32
+ /*
+ When SIGINT is raised on Windows, the OS creates a new thread to handle the
+ interrupt. Once that thread completes, the main thread continues running
+ only to find that it's resources have already been free'd when the sigint
+ handler called mysql_end().
+ */
+ mysql_thread_end();
+ return;
+#else
+ mysql_end(sig);
+#endif
}