summaryrefslogtreecommitdiff
path: root/mysys/thr_lock.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-09-03 12:58:41 +0200
committerSergei Golubchik <serg@mariadb.org>2015-09-03 12:58:41 +0200
commit530a6e74819ec14b5fdc42aa588b236ecb9f2fcd (patch)
treea4d45b1fd0e434c23577507364fa443226676eb5 /mysys/thr_lock.c
parent5088cbf4ed7224698678f3eaf406361c6e7db4b8 (diff)
parent4b41e3c7f33714186c97a6cc2e6d3bb93b050c61 (diff)
downloadmariadb-git-530a6e74819ec14b5fdc42aa588b236ecb9f2fcd.tar.gz
Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile, was taken from 10.0-galera
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r--mysys/thr_lock.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index dfff3b28440..8990cbd5a14 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -1849,7 +1849,7 @@ static void *test_thread(void *arg)
thread_count--;
mysql_cond_signal(&COND_thread_count); /* Tell main we are ready */
mysql_mutex_unlock(&LOCK_thread_count);
- free((uchar*) arg);
+ my_thread_end();
return 0;
}
@@ -1858,7 +1858,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param,error;
+ int param[array_elements(lock_counts)], error;
uint i;
MY_INIT(argv[0]);
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
@@ -1914,8 +1914,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
#endif
for (i=0 ; i < array_elements(lock_counts) ; i++)
{
- param=(int*) malloc(sizeof(int));
- *param=i;
+ param[i]= i;
if ((error= mysql_mutex_lock(&LOCK_thread_count)))
{
@@ -1925,7 +1924,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
}
if ((error= mysql_thread_create(0,
&tid, &thr_attr, test_thread,
- (void*) param)))
+ (void*) &param[i])))
{
fprintf(stderr, "Got error: %d from mysql_thread_create (errno: %d)\n",
error, errno);
@@ -1954,6 +1953,9 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
else
#endif
printf("Test succeeded\n");
+ mysql_cond_destroy(&COND_thread_count);
+ mysql_mutex_destroy(&LOCK_thread_count);
+ my_end(MY_CHECK_ERROR);
return 0;
}