#At file:///home/bm136801/my/mtr-tr/ based on revid:bjorn.munch@stripped
2967 Bjorn Munch 2010-09-14 [merge]
upmerge 55426(55546), 56647
modified:
client/mysqltest.cc
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2010-09-01 14:02:56 +0000
+++ b/client/mysqltest.cc 2010-09-14 11:23:14 +0000
@@ -252,6 +252,7 @@ struct st_connection
int cur_query_len;
pthread_mutex_t mutex;
pthread_cond_t cond;
+ pthread_t tid;
int query_done;
#endif /*EMBEDDED_LIBRARY*/
};
@@ -732,8 +733,6 @@ pthread_handler_t send_one_query(void *a
static int do_send_query(struct st_connection *cn, const char *q, int q_len,
int flags)
{
- pthread_t tid;
-
if (flags & QUERY_REAP_FLAG)
return mysql_send_query(&cn->mysql, q, q_len);
@@ -744,7 +743,7 @@ static int do_send_query(struct st_conne
cn->cur_query= q;
cn->cur_query_len= q_len;
cn->query_done= 0;
- if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn))
+ if (pthread_create(&cn->tid, &cn_thd_attrib, send_one_query, (void*)cn))
die("Cannot start new thread for query");
return 0;
@@ -759,6 +758,11 @@ static void wait_query_thread_end(struct
pthread_cond_wait(&con->cond, &con->mutex);
pthread_mutex_unlock(&con->mutex);
}
+ if (con->tid)
+ {
+ pthread_join(con->tid, NULL);
+ con->tid= 0;
+ }
}
#else /*EMBEDDED_LIBRARY*/
@@ -5219,6 +5223,7 @@ void do_connect(struct st_command *comma
#ifdef EMBEDDED_LIBRARY
con_slot->query_done= 1;
+ con_slot->tid= 0;
#endif
if (!mysql_init(&con_slot->mysql))
die("Failed on mysql_init()");
@@ -7357,11 +7362,10 @@ void run_query(struct st_connection *cn,
(flags & QUERY_REAP_FLAG));
DBUG_ENTER("run_query");
- init_dynamic_string(&ds_warnings, NULL, 0, 256);
-
if (cn->pending && (flags & QUERY_SEND_FLAG))
die ("Cannot run query on connection between send and reap");
+ init_dynamic_string(&ds_warnings, NULL, 0, 256);
/*
Evaluate query if this is an eval command
*/
Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20100914112314-3qy0gsx1uwaiqb48.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-mtr branch (bjorn.munch:2967) | Bjorn Munch | 14 Sep |