You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
This reverts commit f916e64927
.
This commit is contained in:
@ -32,7 +32,6 @@ using namespace logging;
|
||||
#include "threadnaming.h"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <chrono>
|
||||
#include "boost/date_time/posix_time/posix_time_types.hpp"
|
||||
#include "mcsconfig.h"
|
||||
|
||||
@ -53,7 +52,7 @@ ThreadPool::~ThreadPool() throw()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::unique_lock initLock(fInitMutex);
|
||||
boost::mutex::scoped_lock initLock(fInitMutex);
|
||||
stop();
|
||||
}
|
||||
catch (...)
|
||||
@ -63,7 +62,7 @@ ThreadPool::~ThreadPool() throw()
|
||||
|
||||
void ThreadPool::init()
|
||||
{
|
||||
std::unique_lock initLock(fInitMutex);
|
||||
boost::mutex::scoped_lock initLock(fInitMutex);
|
||||
fThreadCount = 0;
|
||||
fGeneralErrors = 0;
|
||||
fFunctorErrors = 0;
|
||||
@ -78,20 +77,20 @@ void ThreadPool::init()
|
||||
|
||||
void ThreadPool::setQueueSize(size_t queueSize)
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
fQueueSize = queueSize;
|
||||
}
|
||||
|
||||
void ThreadPool::pruneThread()
|
||||
{
|
||||
utils::setThreadName("pruneThread");
|
||||
std::unique_lock<std::mutex> lock2(fPruneMutex);
|
||||
boost::unique_lock<boost::mutex> lock2(fPruneMutex);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (fStop)
|
||||
return;
|
||||
if (fPruneThreadEnd.wait_for(lock2, std::chrono::minutes{1}) == std::cv_status::timeout)
|
||||
if (fPruneThreadEnd.wait_for(lock2, boost::chrono::minutes{1}) == boost::cv_status::timeout)
|
||||
{
|
||||
while (!fPruneThreads.empty())
|
||||
{
|
||||
@ -120,13 +119,13 @@ void ThreadPool::pruneThread()
|
||||
|
||||
void ThreadPool::setMaxThreads(size_t maxThreads)
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
fMaxThreads = maxThreads;
|
||||
}
|
||||
|
||||
void ThreadPool::stop()
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
if (fStop)
|
||||
return; // Was stopped earlier
|
||||
fStop = true;
|
||||
@ -141,7 +140,7 @@ void ThreadPool::stop()
|
||||
|
||||
void ThreadPool::wait()
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
|
||||
while (waitingFunctorsSize > 0)
|
||||
{
|
||||
@ -152,7 +151,7 @@ void ThreadPool::wait()
|
||||
|
||||
void ThreadPool::join(uint64_t thrHandle)
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
|
||||
while (waitingFunctorsSize > 0)
|
||||
{
|
||||
@ -182,7 +181,7 @@ void ThreadPool::join(uint64_t thrHandle)
|
||||
|
||||
void ThreadPool::join(std::vector<uint64_t>& thrHandle)
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
|
||||
while (waitingFunctorsSize > 0)
|
||||
{
|
||||
@ -223,7 +222,7 @@ void ThreadPool::join(std::vector<uint64_t>& thrHandle)
|
||||
|
||||
uint64_t ThreadPool::invoke(const Functor_T& threadfunc)
|
||||
{
|
||||
std::unique_lock lock1(fMutex);
|
||||
boost::mutex::scoped_lock lock1(fMutex);
|
||||
uint64_t thrHandle = 0;
|
||||
|
||||
for (;;)
|
||||
@ -320,7 +319,7 @@ void ThreadPool::beginThread() throw()
|
||||
utils::setThreadName("Idle");
|
||||
try
|
||||
{
|
||||
std::unique_lock<std::mutex> lock1(fMutex);
|
||||
boost::unique_lock<boost::mutex> lock1(fMutex);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -339,11 +338,11 @@ void ThreadPool::beginThread() throw()
|
||||
else
|
||||
{
|
||||
// Wait no more than 10 minutes
|
||||
if (fNeedThread.wait_for(lock1, std::chrono::minutes{10}) == std::cv_status::timeout)
|
||||
if (fNeedThread.wait_for(lock1, boost::chrono::minutes{10}) == boost::cv_status::timeout)
|
||||
{
|
||||
if (fThreadCount > fMaxThreads)
|
||||
{
|
||||
std::unique_lock lock2(fPruneMutex);
|
||||
boost::mutex::scoped_lock lock2(fPruneMutex);
|
||||
fPruneThreads.push(boost::this_thread::get_id());
|
||||
--fThreadCount;
|
||||
return;
|
||||
|
Reference in New Issue
Block a user