1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-31 22:22:30 +03:00

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.
This commit is contained in:
Vladislav Vaintroub
2019-11-15 23:51:49 +01:00
parent 15c7f684ec
commit c233d406cb

View File

@@ -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);
}
}