List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:September 14 2010 11:17am
Subject:bzr commit into mysql-5.1-mtr branch (bjorn.munch:2930) Bug#55426 Bug#55546
View as plain text  
#At file:///home/bm136801/my/valgreap-51/ based on revid:bjorn.munch@stripped

 2930 Bjorn Munch	2010-09-14
      Bug #55426 mysqltest crashes when trying to unlock not acquired mutex
      Bug #55546 mysqltest fails to create a new thread on HPUX
      Missing call to pthread_join(), in embedded mode
      This independently solves both problems, see 55426 for details.

    modified:
      client/mysqltest.cc
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-09-10 11:08:06 +0000
+++ b/client/mysqltest.cc	2010-09-14 11:17:04 +0000
@@ -242,6 +242,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*/
 };
@@ -733,8 +734,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);
 
@@ -745,7 +744,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;
@@ -760,6 +759,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*/
@@ -5187,6 +5191,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()");


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20100914111704-2ap0f2mipc6ufaly.bundle
Thread
bzr commit into mysql-5.1-mtr branch (bjorn.munch:2930) Bug#55426 Bug#55546Bjorn Munch14 Sep