diff options
author | unknown <tnurnberg@white.intern.koehntopp.de> | 2008-03-27 23:35:56 +0100 |
---|---|---|
committer | unknown <tnurnberg@white.intern.koehntopp.de> | 2008-03-27 23:35:56 +0100 |
commit | ed1d366a23e4320e0dcee29c642c94e6ce491fd3 (patch) | |
tree | b9f89b444f3abe5cf19b8d54c93829194bd6ace8 /client | |
parent | 0db1f520c629455b4766c3d8f57a9767d7f6a98f (diff) | |
parent | 8e473edd486e35cd80617db5220c89e933995a56 (diff) | |
download | mariadb-git-ed1d366a23e4320e0dcee29c642c94e6ce491fd3.tar.gz |
Merge mysql.com:/misc/mysql/mysql-5.0
into mysql.com:/misc/mysql/mysql-5.0-opt
CMakeLists.txt:
Auto merged
configure.in:
Auto merged
include/config-win.h:
Auto merged
include/my_global.h:
Auto merged
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 05c9ced3848..1d85e777e48 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -550,6 +550,17 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, return 0; } +static void wait_query_thread_end(struct st_connection *con) +{ + if (!con->query_done) + { + pthread_mutex_lock(&con->mutex); + while (!con->query_done) + pthread_cond_wait(&con->cond, &con->mutex); + pthread_mutex_unlock(&con->mutex); + } +} + #else /*EMBEDDED_LIBRARY*/ #define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len) @@ -4071,7 +4082,14 @@ void do_close_connection(struct st_command *command) con->mysql.net.vio = 0; } } -#endif +#else + /* + As query could be still executed in a separate theread + we need to check if the query's thread was finished and probably wait + (embedded-server specific) + */ + wait_query_thread_end(con); +#endif /*EMBEDDED_LIBRARY*/ if (con->stmt) mysql_stmt_close(con->stmt); con->stmt= 0; @@ -4361,6 +4379,9 @@ void do_connect(struct st_command *command) (int) (sizeof(connections)/sizeof(struct st_connection))); } +#ifdef EMBEDDED_LIBRARY + con_slot->query_done= 1; +#endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); if (opt_compress || con_compress) @@ -5848,16 +5869,11 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, } #ifdef EMBEDDED_LIBRARY /* - Here we handle 'reap' command, so we need to check if the - query's thread was finished and probably wait + Here we handle 'reap' command, so we need to check if the + query's thread was finished and probably wait */ else if (flags & QUERY_REAP_FLAG) - { - pthread_mutex_lock(&cn->mutex); - while (!cn->query_done) - pthread_cond_wait(&cn->cond, &cn->mutex); - pthread_mutex_unlock(&cn->mutex); - } + wait_query_thread_end(cn); #endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) DBUG_VOID_RETURN; |