summaryrefslogtreecommitdiff
path: root/tpool/task_group.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-11-15 23:51:49 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2019-11-15 23:51:49 +0100
commitc233d406cb50d987a5200b51c64d99c33dd77013 (patch)
treecbd20f65b5feaa55e3925913562b334cb8db2155 /tpool/task_group.cc
parent15c7f684ec5d84de08a444cf7282dee2f59e3c29 (diff)
downloadmariadb-git-c233d406cb50d987a5200b51c64d99c33dd77013.tar.gz
Fix compile error on centos6. it does not like std::this_thread::sleep()
Simplify task_group destructor. No tasks must be running or queued into task group is being destroyed.
Diffstat (limited to 'tpool/task_group.cc')
-rw-r--r--tpool/task_group.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/tpool/task_group.cc b/tpool/task_group.cc
index d65c658a198..ec9988ded6e 100644
--- a/tpool/task_group.cc
+++ b/tpool/task_group.cc
@@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
#include <condition_variable>
#include <tpool_structs.h>
#include <thread>
+#include <assert.h>
namespace tpool
{
task_group::task_group(unsigned int max_concurrency) :
@@ -78,13 +79,6 @@ namespace tpool
task_group::~task_group()
{
- std::unique_lock<std::mutex> lk(m_mtx);
- m_queue.clear();
- while (m_tasks_running)
- {
- lk.unlock();
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
- lk.lock();
- }
+ assert(m_queue.empty() && !m_tasks_running);
}
-} \ No newline at end of file
+}