summaryrefslogtreecommitdiff
path: root/sql/threadpool_generic.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-13 18:18:25 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-13 18:18:25 +0300
commit4bd56a697ff2d2edc230a82dbfcf4412ef0996df (patch)
tree77a6e74518875d83ecaf6447b5f5b8801ef50b2f /sql/threadpool_generic.cc
parent863e28ff3ed0a5859561c397cbfb492170989ddd (diff)
parent3e617b8bef50a81b10b8152d800a1b8b38859913 (diff)
downloadmariadb-git-4bd56a697ff2d2edc230a82dbfcf4412ef0996df.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/threadpool_generic.cc')
-rw-r--r--sql/threadpool_generic.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 2433369dbbb..8b424591ba6 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -1078,7 +1078,10 @@ void thread_group_destroy(thread_group_t *thread_group)
#endif
if (my_atomic_add32(&shutdown_group_count, -1) == 1)
+ {
my_free(all_groups);
+ all_groups= 0;
+ }
}
/**
@@ -1671,6 +1674,14 @@ TP_pool_generic::~TP_pool_generic()
{
thread_group_close(&all_groups[i]);
}
+
+ /*
+ Wait until memory occupied by all_groups is freed.
+ */
+ int timeout_ms=5000;
+ while(all_groups && timeout_ms--)
+ my_sleep(1000);
+
threadpool_started= false;
DBUG_VOID_RETURN;
}